unlink target of rename before renaming

This commit is contained in:
Johannes Schindelin
2006-09-19 19:03:20 +02:00
committed by Johannes Sixt
parent 41dfee75f1
commit 1c68fe96bc

1
refs.c
View File

@@ -339,6 +339,7 @@ int create_symref(const char *ref_target, const char *refs_heads_master)
error("Unable to write to %s", lockpath);
return -2;
}
unlink(git_HEAD);
if (rename(lockpath, git_HEAD) < 0) {
unlink(lockpath);
error("Unable to create %s", git_HEAD);