]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script: fix credits.sh showing 0 lines changed for mapped emails
authorCasey Bodley <cbodley@redhat.com>
Tue, 8 Aug 2023 14:00:22 +0000 (10:00 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 17 Aug 2023 14:54:46 +0000 (10:54 -0400)
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 <rzarzynski@redhat.com>
   307      0 Mike Perez <miperez@redhat.com>
   308      0 Michael J. Kidd <linuxkidd@redhat.com>
   309      0 Lukas Mayer <lmayer@wind.gmbh>
   310      0 Luis Henriques <lhenriques@suse.com>
   311      0 Kyle McGough <kmcgough@digitalocean.com>
   312      0 João Eduardo Luís <joao@suse.de>
   313      0 JinyongHa <jy200.ha@samsung.com>
   314      0 Ilya Dryomov <idryomov@redhat.com>
```

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 <rzarzynski@redhat.com>
    16   10051 Ilya Dryomov <idryomov@redhat.com>
```

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/script/credits.sh

index 933003a80a154fdc6cb19d113ebb898f0335a2d1..53b1004e560b5bc95b016a38eeff101fd9242dfb 100755 (executable)
@@ -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(<STDIN>) { if(/(\d+)\t(\d+)/) { $added += $1; $deleted += $2 } }; print $added + $deleted;')
     (( author2lines["${mail2author[$mail]}"] += $count ))