summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c0f5c69)
raw | patch | inline | side by side (parent: c0f5c69)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 26 Jun 2008 22:34:54 +0000 (15:34 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 27 Jun 2008 01:13:49 +0000 (18:13 -0700) |
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>
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>
diff.c | patch | blob | history |
index 893942359bee551e4460449f66279f1a91ec6ab7..c00d633c12cb82619159eb964ef2aa1ee43387cc 100644 (file)
--- a/diff.c
+++ b/diff.c
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;
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 {