@@ -3663,7 +3663,7 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
3663
3663
{
3664
3664
mmfile_t mf1 , mf2 ;
3665
3665
struct diffstat_file * data ;
3666
- int same_contents ;
3666
+ int may_differ ;
3667
3667
int complete_rewrite = 0 ;
3668
3668
3669
3669
if (!DIFF_PAIR_UNMERGED (p )) {
@@ -3681,12 +3681,14 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
3681
3681
return ;
3682
3682
}
3683
3683
3684
- same_contents = oideq (& one -> oid , & two -> oid );
3684
+ /* saves some reads if true, not a guarantee of diff outcome */
3685
+ may_differ = !(one -> oid_valid && two -> oid_valid &&
3686
+ oideq (& one -> oid , & two -> oid ));
3685
3687
3686
3688
if (diff_filespec_is_binary (o -> repo , one ) ||
3687
3689
diff_filespec_is_binary (o -> repo , two )) {
3688
3690
data -> is_binary = 1 ;
3689
- if (same_contents ) {
3691
+ if (! may_differ ) {
3690
3692
data -> added = 0 ;
3691
3693
data -> deleted = 0 ;
3692
3694
} else {
@@ -3702,7 +3704,7 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
3702
3704
data -> added = count_lines (two -> data , two -> size );
3703
3705
}
3704
3706
3705
- else if (! same_contents ) {
3707
+ else if (may_differ ) {
3706
3708
/* Crazy xdl interfaces.. */
3707
3709
xpparam_t xpp ;
3708
3710
xdemitconf_t xecfg ;
@@ -3727,7 +3729,7 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
3727
3729
diffstat -> files [diffstat -> nr - 1 ];
3728
3730
/*
3729
3731
* Omit diffstats of modified files where nothing changed.
3730
- * Even if !same_contents , this might be the case due to
3732
+ * Even if may_differ , this might be the case due to
3731
3733
* ignoring whitespace changes, etc.
3732
3734
*
3733
3735
* But note that we special-case additions, deletions,
0 commit comments