diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-06-26 15:34:54 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-06-26 18:13:49 -0700 |
commit | 5ff10dd602f5926f0f5a73ae7de5866713428aa7 (patch) | |
tree | 1ae8e0809f42eedd3088da31f14eb6cf28739fe7 /diff.c | |
parent | c0f5c69c680395a45294184dcf0923cea530b9af (diff) | |
download | git-5ff10dd602f5926f0f5a73ae7de5866713428aa7.tar.gz git-5ff10dd602f5926f0f5a73ae7de5866713428aa7.tar.xz |
diff --check: explain why we do not care whether old side is binary
All other codepaths refrain from running textual diff when either the old
or the new side is binary, but this function only checks the new side. I
was almost going to change it to check both, but that would be a bad
change. Explain why to prevent future mistakes.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -1544,8 +1544,9 @@ static void builtin_diffstat(const char *name_a, const char *name_b, static void builtin_checkdiff(const char *name_a, const char *name_b, const char *attr_path, - struct diff_filespec *one, - struct diff_filespec *two, struct diff_options *o) + struct diff_filespec *one, + struct diff_filespec *two, + struct diff_options *o) { mmfile_t mf1, mf2; struct checkdiff_t data; @@ -1564,6 +1565,12 @@ static void builtin_checkdiff(const char *name_a, const char *name_b, if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0) die("unable to read files to diff"); + /* + * All the other codepaths check both sides, but not checking + * the "old" side here is deliberate. We are checking the newly + * introduced changes, and as long as the "new" side is text, we + * can and should check what it introduces. + */ if (diff_filespec_is_binary(two)) goto free_and_return; else { |