Skip to content

Commit

Permalink
Merge branch 'ag/maint-combine-diff-fix' into maint
Browse files Browse the repository at this point in the history
* ag/maint-combine-diff-fix:
  Respect core.autocrlf in combined diff
  • Loading branch information
Junio C Hamano committed Aug 24, 2008
2 parents 97e5f49 + 5e568f9 commit fb70928
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions combine-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 16 additions & 0 deletions t/t4015-diff-whitespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -352,4 +352,20 @@ test_expect_success 'checkdiff allows new blank lines' '
git diff --check
'

test_expect_success 'combined diff with autocrlf conversion' '
git reset --hard &&
echo >x hello &&
git commit -m "one side" x &&
git checkout HEAD^ &&
echo >x goodbye &&
git commit -m "the other side" x &&
git config core.autocrlf true &&
test_must_fail git merge master &&
git diff | sed -e "1,/^@@@/d" >actual &&
! grep "^-" actual
'

test_done

0 comments on commit fb70928

Please sign in to comment.