summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e0e324a)
raw | patch | inline | side by side (parent: e0e324a)
author | Junio C Hamano <gitster@pobox.com> | |
Sat, 7 Jul 2007 19:25:11 +0000 (12:25 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 7 Jul 2007 19:25:11 +0000 (12:25 -0700) |
The code shuffling mistakenly lost binariness specified with the
attribute mecahnism and made it always guess from the data.
Noticed by Johannes, with two test cases to t4020.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attribute mecahnism and made it always guess from the data.
Noticed by Johannes, with two test cases to t4020.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c | patch | blob | history | |
t/t4020-diff-external.sh | patch | blob | history |
index 21e61af265570f2795a45a7c87cff49094f45b1d..b8473f58fbde20516bcfa1e0c1dcb2de16be819f 100644 (file)
--- a/diff.c
+++ b/diff.c
static void diff_filespec_check_attr(struct diff_filespec *one)
{
struct git_attr_check attr_diff_check;
+ int check_from_data = 0;
if (one->checked_attr)
return;
;
else if (ATTR_FALSE(value))
one->is_binary = 1;
+ else
+ check_from_data = 1;
/* funcname pattern ident */
if (ATTR_TRUE(value) || ATTR_FALSE(value) || ATTR_UNSET(value))
one->funcname_pattern_ident = value;
}
- if (!one->data && DIFF_FILE_VALID(one))
- diff_populate_filespec(one, 0);
-
- if (one->data)
- one->is_binary = buffer_is_binary(one->data, one->size);
+ if (check_from_data) {
+ if (!one->data && DIFF_FILE_VALID(one))
+ diff_populate_filespec(one, 0);
+ if (one->data)
+ one->is_binary = buffer_is_binary(one->data, one->size);
+ }
}
int diff_filespec_is_binary(struct diff_filespec *one)
index f0045cd788a275f525bbd94912c5ad09cf6226bd..ed3bd5b3fe7c8b5ca52067e3015e0d770ee79bf2 100755 (executable)
--- a/t/t4020-diff-external.sh
+++ b/t/t4020-diff-external.sh
'
+test_expect_success 'no diff with -diff' '
+ echo >.gitattributes "file -diff" &&
+ git diff | grep Binary
+'
+
+echo NULZbetweenZwords | tr Z '\0' > file
+
+test_expect_success 'force diff with "diff"' '
+ echo >.gitattributes "file diff" &&
+ git diff | grep -a second
+'
+
test_done