summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2007-03-03 20:32:46 +0100
committerJunio C Hamano <junkio@cox.net>2007-03-03 18:59:41 -0800
commit723024d696a47556baac77700e47fef288691f37 (patch)
tree6c1d71a57f78ba89d54266cf64ee3a37aaf08251 /merge-recursive.c
parent78a8d641c14dc2f0a306d787fa1e42d400b3af4d (diff)
downloadgit-723024d696a47556baac77700e47fef288691f37.tar.gz
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 <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c3
1 files changed, 2 insertions, 1 deletions
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);