summaryrefslogtreecommitdiff
path: root/combine-diff.c
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2008-08-23 19:21:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-08-24 06:59:20 (GMT)
commit5e568f9e3027797842807213ce590140c9daf9ce (patch)
treefa21172efdcaa4720c73c814e21721323c9abe7b /combine-diff.c
parent913e0e99b6a6e63af6a062622a1f94bd78fd8052 (diff)
downloadgit-5e568f9e3027797842807213ce590140c9daf9ce.zip
git-5e568f9e3027797842807213ce590140c9daf9ce.tar.gz
git-5e568f9e3027797842807213ce590140c9daf9ce.tar.bz2
Respect core.autocrlf in combined diff
Fix git-diff to make it produce useful 3-way diffs for merge conflicts in repositories with autocrlf enabled. Otherwise it always reports that the whole file was changed, because it uses the contents from the working tree without necessary conversion. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'combine-diff.c')
-rw-r--r--combine-diff.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/combine-diff.c b/combine-diff.c
index 9f80a1c..4dfc330 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -727,6 +727,18 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
die("early EOF '%s'", elem->path);
result[len] = 0;
+
+ /* If not a fake symlink, apply filters, e.g. autocrlf */
+ if (is_file) {
+ struct strbuf buf;
+
+ strbuf_init(&buf, 0);
+ if (convert_to_git(elem->path, result, len, &buf, safe_crlf)) {
+ free(result);
+ result = strbuf_detach(&buf, &len);
+ result_size = len;
+ }
+ }
}
else {
deleted_file: