File tree 1 file changed +11
-3
lines changed 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -207,12 +207,20 @@ for FILE in $C_FILES; do
207
207
fi
208
208
done
209
209
210
+ # Show insertion and deletion counts.
210
211
if [ " ${# FILES[@]} " -gt 0 ]; then
211
212
echo " Following files were changed:"
212
213
for file in " ${FILES[@]} " ; do
213
- if command -v diffstat > /dev/null 2>&1 ; then
214
- summary=$( git diff --cached " $file " | diffstat -s | sed -E ' s/^[[:space:]]*[0-9]+ files? changed,?[[:space:]]*//' )
215
- echo " - $file | $summary "
214
+ summary=$( git diff --cached --numstat " $file " | awk ' {
215
+ if ($1 != "0" && $2 != "0")
216
+ printf "%s insertions(+), %s deletions(-)", $1, $2;
217
+ else if ($1 != "0")
218
+ printf "%s insertions(+)", $1;
219
+ else if ($2 != "0")
220
+ printf "%s deletions(-)", $2;
221
+ }' )
222
+ if [ -n " $summary " ]; then
223
+ echo " - $file : $summary "
216
224
else
217
225
echo " - $file "
218
226
fi
You can’t perform that action at this time.
0 commit comments