From: Casey Bodley Date: Tue, 8 Aug 2023 14:00:22 +0000 (-0400) Subject: script: fix credits.sh showing 0 lines changed for mapped emails X-Git-Tag: v19.0.0~656^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=902bcd7bc4408a8ef02472ab2b9234e685daf75e;p=ceph.git script: fix credits.sh showing 0 lines changed for mapped emails script was showing 0 for several contributors because the commit Author: did not match their mapped address: ``` Number of lines added and removed, by authors ... 306 0 Radoslaw Zarzynski 307 0 Mike Perez 308 0 Michael J. Kidd 309 0 Lukas Mayer 310 0 Luis Henriques 311 0 Kyle McGough 312 0 João Eduardo Luís 313 0 JinyongHa 314 0 Ilya Dryomov ``` in the case of Ilya and Radoslaw: ``` $ git log --no-merges --pretty='%ae' v17.2.6..v18.2.0 | sed -e "s/'/ /g" | sort -u | grep -e idryomov -e rzarzyns idryomov@gmail.com rzarzyns@redhat.com ``` this output gets fed into `git log --numstat --author="$mail"` to fetch the stats, but that command maps idryomov@gmail.com -> idryomov@redhat.com and rzarzyns@redhat.com -> rzarzynski@redhat.com so no commits matched. disabling the mapping for this command with --no-mailmap allows it to fetch their stats correctly: ``` 14 11809 Radoslaw Zarzynski 16 10051 Ilya Dryomov ``` Signed-off-by: Casey Bodley --- diff --git a/src/script/credits.sh b/src/script/credits.sh index 933003a80a154..53b1004e560b5 100755 --- a/src/script/credits.sh +++ b/src/script/credits.sh @@ -16,7 +16,7 @@ declare -A author2lines declare -A organization2lines git log --no-merges --pretty='%ae' $range | sed -e "$remap" | sort -u > $TMP while read mail ; do - count=$(git log --numstat --author="$mail" --pretty='%h' $range | + count=$(git log --numstat --author="$mail" --pretty='%h' --no-mailmap $range | grep -E -v 'package-lock\.json|\.xlf' | # generated files that should be excluded from line counting perl -e 'while() { if(/(\d+)\t(\d+)/) { $added += $1; $deleted += $2 } }; print $added + $deleted;') (( author2lines["${mail2author[$mail]}"] += $count ))