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:
commit
42dd2cd3a3
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue