@@ -3007,6 +3007,24 @@ static int dirstat_compare(const void *_a, const void *_b)
3007
3007
return strcmp (a -> name , b -> name );
3008
3008
}
3009
3009
3010
+ static void conclude_dirstat (struct diff_options * options ,
3011
+ struct dirstat_dir * dir ,
3012
+ unsigned long changed )
3013
+ {
3014
+ struct dirstat_file * to_free = dir -> files ;
3015
+
3016
+ if (!changed ) {
3017
+ /* This can happen even with many files, if everything was renames */
3018
+ ;
3019
+ } else {
3020
+ /* Show all directories with more than x% of the changes */
3021
+ QSORT (dir -> files , dir -> nr , dirstat_compare );
3022
+ gather_dirstat (options , dir , changed , "" , 0 );
3023
+ }
3024
+
3025
+ free (to_free );
3026
+ }
3027
+
3010
3028
static void show_dirstat (struct diff_options * options )
3011
3029
{
3012
3030
int i ;
@@ -3096,13 +3114,7 @@ static void show_dirstat(struct diff_options *options)
3096
3114
dir .nr ++ ;
3097
3115
}
3098
3116
3099
- /* This can happen even with many files, if everything was renames */
3100
- if (!changed )
3101
- return ;
3102
-
3103
- /* Show all directories with more than x% of the changes */
3104
- QSORT (dir .files , dir .nr , dirstat_compare );
3105
- gather_dirstat (options , & dir , changed , "" , 0 );
3117
+ conclude_dirstat (options , & dir , changed );
3106
3118
}
3107
3119
3108
3120
static void show_dirstat_by_line (struct diffstat_t * data , struct diff_options * options )
@@ -3140,13 +3152,7 @@ static void show_dirstat_by_line(struct diffstat_t *data, struct diff_options *o
3140
3152
dir .nr ++ ;
3141
3153
}
3142
3154
3143
- /* This can happen even with many files, if everything was renames */
3144
- if (!changed )
3145
- return ;
3146
-
3147
- /* Show all directories with more than x% of the changes */
3148
- QSORT (dir .files , dir .nr , dirstat_compare );
3149
- gather_dirstat (options , & dir , changed , "" , 0 );
3155
+ conclude_dirstat (options , & dir , changed );
3150
3156
}
3151
3157
3152
3158
static void free_diffstat_file (struct diffstat_file * f )
0 commit comments