@@ -1309,6 +1309,7 @@ struct diffstat_t {
1309
1309
unsigned is_unmerged :1 ;
1310
1310
unsigned is_binary :1 ;
1311
1311
unsigned is_renamed :1 ;
1312
+ unsigned is_interesting :1 ;
1312
1313
uintmax_t added , deleted ;
1313
1314
} * * files ;
1314
1315
};
@@ -1478,7 +1479,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
1478
1479
for (i = 0 ; (i < count ) && (i < data -> nr ); i ++ ) {
1479
1480
struct diffstat_file * file = data -> files [i ];
1480
1481
uintmax_t change = file -> added + file -> deleted ;
1481
- if (!data -> files [i ]-> is_renamed &&
1482
+ if (!data -> files [i ]-> is_interesting &&
1482
1483
(change == 0 )) {
1483
1484
count ++ ; /* not shown == room for one more */
1484
1485
continue ;
@@ -1599,7 +1600,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
1599
1600
uintmax_t deleted = data -> files [i ]-> deleted ;
1600
1601
int name_len ;
1601
1602
1602
- if (!data -> files [i ]-> is_renamed &&
1603
+ if (!data -> files [i ]-> is_interesting &&
1603
1604
(added + deleted == 0 )) {
1604
1605
total_files -- ;
1605
1606
continue ;
@@ -1678,7 +1679,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
1678
1679
for (i = count ; i < data -> nr ; i ++ ) {
1679
1680
uintmax_t added = data -> files [i ]-> added ;
1680
1681
uintmax_t deleted = data -> files [i ]-> deleted ;
1681
- if (!data -> files [i ]-> is_renamed &&
1682
+ if (!data -> files [i ]-> is_interesting &&
1682
1683
(added + deleted == 0 )) {
1683
1684
total_files -- ;
1684
1685
continue ;
@@ -1706,7 +1707,7 @@ static void show_shortstats(struct diffstat_t *data, struct diff_options *option
1706
1707
1707
1708
if (data -> files [i ]-> is_unmerged )
1708
1709
continue ;
1709
- if (!data -> files [i ]-> is_renamed && (added + deleted == 0 )) {
1710
+ if (!data -> files [i ]-> is_interesting && (added + deleted == 0 )) {
1710
1711
total_files -- ;
1711
1712
} else if (!data -> files [i ]-> is_binary ) { /* don't count bytes */
1712
1713
adds += added ;
@@ -2406,13 +2407,20 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
2406
2407
struct diff_filespec * two ,
2407
2408
struct diffstat_t * diffstat ,
2408
2409
struct diff_options * o ,
2409
- int complete_rewrite )
2410
+ struct diff_filepair * p )
2410
2411
{
2411
2412
mmfile_t mf1 , mf2 ;
2412
2413
struct diffstat_file * data ;
2413
2414
int same_contents ;
2415
+ int complete_rewrite = 0 ;
2416
+
2417
+ if (!DIFF_PAIR_UNMERGED (p )) {
2418
+ if (p -> status == DIFF_STATUS_MODIFIED && p -> score )
2419
+ complete_rewrite = 1 ;
2420
+ }
2414
2421
2415
2422
data = diffstat_add (diffstat , name_a , name_b );
2423
+ data -> is_interesting = p -> status != 0 ;
2416
2424
2417
2425
if (!one || !two ) {
2418
2426
data -> is_unmerged = 1 ;
@@ -3123,11 +3131,10 @@ static void run_diffstat(struct diff_filepair *p, struct diff_options *o,
3123
3131
{
3124
3132
const char * name ;
3125
3133
const char * other ;
3126
- int complete_rewrite = 0 ;
3127
3134
3128
3135
if (DIFF_PAIR_UNMERGED (p )) {
3129
3136
/* unmerged */
3130
- builtin_diffstat (p -> one -> path , NULL , NULL , NULL , diffstat , o , 0 );
3137
+ builtin_diffstat (p -> one -> path , NULL , NULL , NULL , diffstat , o , p );
3131
3138
return ;
3132
3139
}
3133
3140
@@ -3140,9 +3147,7 @@ static void run_diffstat(struct diff_filepair *p, struct diff_options *o,
3140
3147
diff_fill_sha1_info (p -> one );
3141
3148
diff_fill_sha1_info (p -> two );
3142
3149
3143
- if (p -> status == DIFF_STATUS_MODIFIED && p -> score )
3144
- complete_rewrite = 1 ;
3145
- builtin_diffstat (name , other , p -> one , p -> two , diffstat , o , complete_rewrite );
3150
+ builtin_diffstat (name , other , p -> one , p -> two , diffstat , o , p );
3146
3151
}
3147
3152
3148
3153
static void run_checkdiff (struct diff_filepair * p , struct diff_options * o )
0 commit comments