File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 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
207207 fi
208208done
209209
210+ # Show insertion and deletion counts.
210211if [ " ${# FILES[@]} " -gt 0 ]; then
211212 echo " Following files were changed:"
212213 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 "
216224 else
217225 echo " - $file "
218226 fi
You can’t perform that action at this time.
0 commit comments