builtin-reflog.c: don't install new reflog on write failure

When expiring reflog entries, a new temporary log is written which contains
only the entries to retain. After it is written, it is renamed to replace
the existing reflog. Currently, we check that writing of the new log is
successful and print a message on failure, but the original reflog is still
replaced with the new reflog even on failure. This patch causes the
original reflog to be retained if we fail when writing the new reflog.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 file changed
tree: 9f163e98fc09d651109323245c71d54a3d403b5f
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. git-gui/
  6. gitk-git/
  7. gitweb/
  8. mozilla-sha1/
  9. perl/
  10. ppc/
  11. t/
  12. templates/
  13. xdiff/
  14. .gitattributes
  15. .gitignore
  16. .mailmap
  17. alloc.c
  18. archive-tar.c
  19. archive-zip.c
  20. archive.c
  21. archive.h
  22. attr.c
  23. attr.h
  24. base85.c
  25. blob.c
  26. blob.h
  27. builtin-add.c
  28. builtin-annotate.c
  29. builtin-apply.c
  30. builtin-archive.c
  31. builtin-blame.c
  32. builtin-branch.c
  33. builtin-bundle.c
  34. builtin-cat-file.c
  35. builtin-check-attr.c
  36. builtin-check-ref-format.c
  37. builtin-checkout-index.c
  38. builtin-clean.c
  39. builtin-commit-tree.c
  40. builtin-commit.c
  41. builtin-config.c
  42. builtin-count-objects.c
  43. builtin-describe.c
  44. builtin-diff-files.c
  45. builtin-diff-index.c
  46. builtin-diff-tree.c
  47. builtin-diff.c
  48. builtin-fast-export.c
  49. builtin-fetch--tool.c
  50. builtin-fetch-pack.c
  51. builtin-fetch.c
  52. builtin-fmt-merge-msg.c
  53. builtin-for-each-ref.c
  54. builtin-fsck.c
  55. builtin-gc.c
  56. builtin-grep.c
  57. builtin-http-fetch.c
  58. builtin-init-db.c
  59. builtin-log.c
  60. builtin-ls-files.c
  61. builtin-ls-remote.c
  62. builtin-ls-tree.c
  63. builtin-mailinfo.c
  64. builtin-mailsplit.c
  65. builtin-merge-base.c
  66. builtin-merge-file.c
  67. builtin-merge-ours.c
  68. builtin-mv.c
  69. builtin-name-rev.c
  70. builtin-pack-objects.c
  71. builtin-pack-refs.c
  72. builtin-prune-packed.c
  73. builtin-prune.c
  74. builtin-push.c
  75. builtin-read-tree.c
  76. builtin-reflog.c
  77. builtin-rerere.c
  78. builtin-reset.c
  79. builtin-rev-list.c
  80. builtin-rev-parse.c
  81. builtin-revert.c
  82. builtin-rm.c
  83. builtin-send-pack.c
  84. builtin-shortlog.c
  85. builtin-show-branch.c
  86. builtin-show-ref.c
  87. builtin-stripspace.c
  88. builtin-symbolic-ref.c
  89. builtin-tag.c
  90. builtin-tar-tree.c
  91. builtin-unpack-objects.c
  92. builtin-update-index.c
  93. builtin-update-ref.c
  94. builtin-upload-archive.c
  95. builtin-verify-pack.c
  96. builtin-verify-tag.c
  97. builtin-write-tree.c
  98. builtin.h
  99. bundle.c
  100. bundle.h
  101. cache-tree.c
  102. cache-tree.h
  103. cache.h
  104. check-builtins.sh
  105. check-racy.c
  106. color.c
  107. color.h
  108. combine-diff.c
  109. command-list.txt
  110. commit.c
  111. commit.h
  112. config.c
  113. config.mak.in
  114. configure.ac
  115. connect.c
  116. convert.c
  117. copy.c
  118. COPYING
  119. csum-file.c
  120. csum-file.h
  121. ctype.c
  122. daemon.c
  123. date.c
  124. decorate.c
  125. decorate.h
  126. delta.h
  127. diff-delta.c
  128. diff-lib.c
  129. diff.c
  130. diff.h
  131. diffcore-break.c
  132. diffcore-delta.c
  133. diffcore-order.c
  134. diffcore-pickaxe.c
  135. diffcore-rename.c
  136. diffcore.h
  137. dir.c
  138. dir.h
  139. dump-cache-tree.c
  140. entry.c
  141. environment.c
  142. exec_cmd.c
  143. exec_cmd.h
  144. fast-import.c
  145. fetch-pack.h
  146. fixup-builtins
  147. generate-cmdlist.sh
  148. git-add--interactive.perl
  149. git-am.sh
  150. git-archimport.perl
  151. git-bisect.sh
  152. git-checkout.sh
  153. git-clone.sh
  154. git-compat-util.h
  155. git-cvsexportcommit.perl
  156. git-cvsimport.perl
  157. git-cvsserver.perl
  158. git-filter-branch.sh
  159. git-instaweb.sh
  160. git-lost-found.sh
  161. git-merge-octopus.sh
  162. git-merge-one-file.sh
  163. git-merge-resolve.sh
  164. git-merge-stupid.sh
  165. git-merge.sh
  166. git-mergetool.sh
  167. git-parse-remote.sh
  168. git-pull.sh
  169. git-quiltimport.sh
  170. git-rebase--interactive.sh
  171. git-rebase.sh
  172. git-relink.perl
  173. git-remote.perl
  174. git-repack.sh
  175. git-request-pull.sh
  176. git-send-email.perl
  177. git-sh-setup.sh
  178. git-stash.sh
  179. git-submodule.sh
  180. git-svn.perl
  181. GIT-VERSION-GEN
  182. git-web--browse.sh
  183. git.c
  184. git.spec.in
  185. grep.c
  186. grep.h
  187. hash-object.c
  188. hash.c
  189. hash.h
  190. help.c
  191. http-push.c
  192. http-walker.c
  193. http.c
  194. http.h
  195. ident.c
  196. imap-send.c
  197. index-pack.c
  198. INSTALL
  199. interpolate.c
  200. interpolate.h
  201. list-objects.c
  202. list-objects.h
  203. lockfile.c
  204. log-tree.c
  205. log-tree.h
  206. mailmap.c
  207. mailmap.h
  208. Makefile
  209. match-trees.c
  210. merge-file.c
  211. merge-index.c
  212. merge-recursive.c
  213. merge-tree.c
  214. mktag.c
  215. mktree.c
  216. object-refs.c
  217. object.c
  218. object.h
  219. pack-check.c
  220. pack-redundant.c
  221. pack-write.c
  222. pack.h
  223. pager.c
  224. parse-options.c
  225. parse-options.h
  226. patch-delta.c
  227. patch-id.c
  228. patch-ids.c
  229. patch-ids.h
  230. path-list.c
  231. path-list.h
  232. path.c
  233. pkt-line.c
  234. pkt-line.h
  235. pretty.c
  236. progress.c
  237. progress.h
  238. quote.c
  239. quote.h
  240. reachable.c
  241. reachable.h
  242. read-cache.c
  243. README
  244. receive-pack.c
  245. reflog-walk.c
  246. reflog-walk.h
  247. refs.c
  248. refs.h
  249. remote.c
  250. remote.h
  251. revision.c
  252. revision.h
  253. run-command.c
  254. run-command.h
  255. send-pack.h
  256. server-info.c
  257. setup.c
  258. sha1_file.c
  259. sha1_name.c
  260. shallow.c
  261. shell.c
  262. show-index.c
  263. sideband.c
  264. sideband.h
  265. strbuf.c
  266. strbuf.h
  267. symlinks.c
  268. tag.c
  269. tag.h
  270. tar.h
  271. test-absolute-path.c
  272. test-chmtime.c
  273. test-date.c
  274. test-delta.c
  275. test-genrandom.c
  276. test-match-trees.c
  277. test-parse-options.c
  278. test-sha1.c
  279. test-sha1.sh
  280. trace.c
  281. transport.c
  282. transport.h
  283. tree-diff.c
  284. tree-walk.c
  285. tree-walk.h
  286. tree.c
  287. tree.h
  288. unpack-file.c
  289. unpack-trees.c
  290. unpack-trees.h
  291. update-server-info.c
  292. upload-pack.c
  293. usage.c
  294. utf8.c
  295. utf8.h
  296. var.c
  297. walker.c
  298. walker.h
  299. write_or_die.c
  300. ws.c
  301. wt-status.c
  302. wt-status.h
  303. xdiff-interface.c
  304. xdiff-interface.h