Fix 'diff' attribute semantics.
authorJunio C Hamano <junkio@cox.net>
Sun, 15 Apr 2007 21:35:11 +0000 (14:35 -0700)
committerJunio C Hamano <junkio@cox.net>
Sun, 15 Apr 2007 21:35:11 +0000 (14:35 -0700)
This is in the same spirit as the previous one. Earlier 'diff'
meant 'do the built-in binary heuristics and disable patch text
generation based on it' while '!diff' meant 'do not guess, do
not generate patch text'. There was no way to say 'do generate
patch text even when the heuristics says it has NUL in it'.

Signed-off-by: Junio C Hamano <junkio@cox.net>
diff.c
diff --git a/diff.c b/diff.c
index e4efb657e8ad8d30d7f0d25b17350fe19840e449..dcea405ed39199164251f2be0c42984a0c86aea5 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1069,8 +1069,9 @@ static int file_is_binary(struct diff_filespec *one)
 
        setup_diff_attr_check(&attr_diff_check);
        if (!git_checkattr(one->path, 1, &attr_diff_check) &&
-           (0 == attr_diff_check.isset))
-               return 1;
+           (0 <= attr_diff_check.isset))
+               return !attr_diff_check.isset;
+
        if (!one->data) {
                if (!DIFF_FILE_VALID(one))
                        return 0;