1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-09 02:33:11 +01:00

Merge branch 'bc/reflog-fix'

* bc/reflog-fix:
  builtin-reflog.c: don't install new reflog on write failure
This commit is contained in:
Junio C Hamano 2008-02-27 11:53:48 -08:00
commit 42dd2cd3a3

View file

@ -276,10 +276,11 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
for_each_reflog_ent(ref, expire_reflog_ent, &cb);
finish:
if (cb.newlog) {
if (fclose(cb.newlog))
if (fclose(cb.newlog)) {
status |= error("%s: %s", strerror(errno),
newlog_path);
if (rename(newlog_path, log_file)) {
unlink(newlog_path);
} else if (rename(newlog_path, log_file)) {
status |= error("cannot rename %s to %s",
newlog_path, log_file);
unlink(newlog_path);