merge-recursive: fix longstanding bug in merging symlinks
Commit 3af244ca added unlink(2) before running symlink(2) to
update the working tree with the merge result, but it was
unlinking a wrong path. This resulted in loss of the path
pointed by a symlink.
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff --git a/merge-recursive.c b/merge-recursive.c
index 5898942..397a7ad 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -589,7 +589,7 @@
memcpy(lnk, buf, size);
lnk[size] = '\0';
mkdir_p(path, 0777);
- unlink(lnk);
+ unlink(path);
symlink(lnk, path);
} else
die("do not know what to do with %06o %s '%s'",