From 723024d696a47556baac77700e47fef288691f37 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sat, 3 Mar 2007 20:32:46 +0100 Subject: Handle core.symlinks=false case in merge-recursive. If the file system does not support symbolic links (core.symlinks=false), merge-recursive must write the merged symbolic link text into a regular file. While we are here, fix a tiny memory leak in the if-branch that writes real symbolic links. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- merge-recursive.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'merge-recursive.c') diff --git a/merge-recursive.c b/merge-recursive.c index 87cd8709bb..c96e1a734c 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -570,7 +570,7 @@ static void update_file_flags(const unsigned char *sha, if (type != OBJ_BLOB) die("blob expected for %s '%s'", sha1_to_hex(sha), path); - if (S_ISREG(mode)) { + if (S_ISREG(mode) || (!has_symlinks && S_ISLNK(mode))) { int fd; if (mkdir_p(path, 0777)) die("failed to create path %s: %s", path, strerror(errno)); @@ -591,6 +591,7 @@ static void update_file_flags(const unsigned char *sha, mkdir_p(path, 0777); unlink(path); symlink(lnk, path); + free(lnk); } else die("do not know what to do with %06o %s '%s'", mode, sha1_to_hex(sha), path); -- cgit v1.2.3