aboutsummaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-02-25 22:24:47 -0800
committerJunio C Hamano <junkio@cox.net>2007-02-25 22:25:30 -0800
commit4fc970c43884e6215c13d6944a2def1eb2134ed5 (patch)
tree19de8184265822e1c47a62847bdecd7eedc61372 /diff-lib.c
parent0b1f6475570b915c56f380f2bd790ff94e606ef4 (diff)
downloadgit-4fc970c43884e6215c13d6944a2def1eb2134ed5.tar.gz
git-4fc970c43884e6215c13d6944a2def1eb2134ed5.tar.xz
diff --cc: fix display of symlink conflicts during a merge.
"git-diff-files --cc" to show conflicts during merge did not pass the correct mode information for the working tree down, and showed bogus combined diff. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 556d5345b..60c0fa648 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -41,17 +41,27 @@ int run_diff_files(struct rev_info *revs, int silent_on_removed)
path_len = ce_namelen(ce);
- dpath = xmalloc (combine_diff_path_size (5, path_len));
+ dpath = xmalloc(combine_diff_path_size(5, path_len));
dpath->path = (char *) &(dpath->parent[5]);
dpath->next = NULL;
dpath->len = path_len;
memcpy(dpath->path, ce->name, path_len);
dpath->path[path_len] = '\0';
- dpath->mode = 0;
hashclr(dpath->sha1);
memset(&(dpath->parent[0]), 0,
- sizeof(struct combine_diff_parent)*5);
+ sizeof(struct combine_diff_parent)*5);
+
+ if (lstat(ce->name, &st) < 0) {
+ if (errno != ENOENT && errno != ENOTDIR) {
+ perror(ce->name);
+ continue;
+ }
+ if (silent_on_removed)
+ continue;
+ }
+ else
+ dpath->mode = canon_mode(st.st_mode);
while (i < entries) {
struct cache_entry *nce = active_cache[i];