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
@ -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);
|
for_each_reflog_ent(ref, expire_reflog_ent, &cb);
|
||||||
finish:
|
finish:
|
||||||
if (cb.newlog) {
|
if (cb.newlog) {
|
||||||
if (fclose(cb.newlog))
|
if (fclose(cb.newlog)) {
|
||||||
status |= error("%s: %s", strerror(errno),
|
status |= error("%s: %s", strerror(errno),
|
||||||
newlog_path);
|
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",
|
status |= error("cannot rename %s to %s",
|
||||||
newlog_path, log_file);
|
newlog_path, log_file);
|
||||||
unlink(newlog_path);
|
unlink(newlog_path);
|
||||||
|
Loading…
Reference in New Issue
Block a user