Code

merge-recursive: fix longstanding bug in merging symlinks
authorJunio C Hamano <junkio@cox.net>
Mon, 26 Feb 2007 02:42:07 +0000 (18:42 -0800)
committerJunio C Hamano <junkio@cox.net>
Mon, 26 Feb 2007 03:08:48 +0000 (19:08 -0800)
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>
merge-recursive.c

index 58989424d77467da018e7daf5761f1f85040d2f6..397a7ad85b4968b9376438f12d0c3c70b7aed880 100644 (file)
@@ -589,7 +589,7 @@ static void update_file_flags(const unsigned char *sha,
                        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'",