mirror of
https://github.com/git/git.git
synced 2026-03-14 10:53:25 +01:00
rename() fails on Windows if the destination exists.
This commit is contained in:
@@ -274,6 +274,12 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
|
||||
if (fclose(cb.newlog))
|
||||
status |= error("%s: %s", strerror(errno),
|
||||
newlog_path);
|
||||
#ifdef __MINGW32__
|
||||
/* rename fails if the destination exists */
|
||||
if (unlink(lock->log_file))
|
||||
status |= error("cannot remove %s", lock->log_file);
|
||||
else
|
||||
#endif
|
||||
if (rename(newlog_path, lock->log_file)) {
|
||||
status |= error("cannot rename %s to %s",
|
||||
newlog_path, lock->log_file);
|
||||
|
||||
Reference in New Issue
Block a user