diff options
| -rw-r--r-- | diff.c | 49 | 
1 files changed, 28 insertions, 21 deletions
@@ -4592,6 +4592,33 @@ static int diff_filespec_is_identical(struct diff_filespec *one,  	return !memcmp(one->data, two->data, one->size);  } +static int diff_filespec_check_stat_unmatch(struct diff_filepair *p) +{ +	/* +	 * 1. Entries that come from stat info dirtiness +	 *    always have both sides (iow, not create/delete), +	 *    one side of the object name is unknown, with +	 *    the same mode and size.  Keep the ones that +	 *    do not match these criteria.  They have real +	 *    differences. +	 * +	 * 2. At this point, the file is known to be modified, +	 *    with the same mode and size, and the object +	 *    name of one side is unknown.  Need to inspect +	 *    the identical contents. +	 */ +	if (!DIFF_FILE_VALID(p->one) || /* (1) */ +	    !DIFF_FILE_VALID(p->two) || +	    (p->one->sha1_valid && p->two->sha1_valid) || +	    (p->one->mode != p->two->mode) || +	    diff_populate_filespec(p->one, 1) || +	    diff_populate_filespec(p->two, 1) || +	    (p->one->size != p->two->size) || +	    !diff_filespec_is_identical(p->one, p->two)) /* (2) */ +		return 1; +	return 0; +} +  static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)  {  	int i; @@ -4602,27 +4629,7 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)  	for (i = 0; i < q->nr; i++) {  		struct diff_filepair *p = q->queue[i]; -		/* -		 * 1. Entries that come from stat info dirtiness -		 *    always have both sides (iow, not create/delete), -		 *    one side of the object name is unknown, with -		 *    the same mode and size.  Keep the ones that -		 *    do not match these criteria.  They have real -		 *    differences. -		 * -		 * 2. At this point, the file is known to be modified, -		 *    with the same mode and size, and the object -		 *    name of one side is unknown.  Need to inspect -		 *    the identical contents. -		 */ -		if (!DIFF_FILE_VALID(p->one) || /* (1) */ -		    !DIFF_FILE_VALID(p->two) || -		    (p->one->sha1_valid && p->two->sha1_valid) || -		    (p->one->mode != p->two->mode) || -		    diff_populate_filespec(p->one, 1) || -		    diff_populate_filespec(p->two, 1) || -		    (p->one->size != p->two->size) || -		    !diff_filespec_is_identical(p->one, p->two)) /* (2) */ +		if (diff_filespec_check_stat_unmatch(p))  			diff_q(&outq, p);  		else {  			/*  | 
