From 1c68fe96bcb66ce340cb1cc40acaddaba2f7fc11 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 19 Sep 2006 19:03:20 +0200 Subject: [PATCH] unlink target of rename before renaming --- refs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/refs.c b/refs.c index 7d858637c4..1c0bf70f2c 100644 --- a/refs.c +++ b/refs.c @@ -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);