Skip to contentSkip to conversation

Updating the .mailmap file

DISCUSSION Stefan Beller 2 participants 2 messages Dec 1, 2012 – Dec 2, 2012

lore
Share & tools
lore
#0 lore raw

Hello,

I was just browsing the shortlog and it looked to me as if there are many double entries, i.e. the same person being there with multiple email addresses.

So I wrote a script, which finds double names and adds them to the .mailmap file. However manual checking, whether these are really the same person is required.

---
#!/bin/bash

git shortlog -sne > shortlog.txt

# find double names in the shortlog
cat shortlog.txt |awk '{ NF--; $1=""; print }' |sort |uniq -d | sed 's/^ *//g' > names.txt

while read line
do
echo "process name $line"
# get the current mailmap file in a state where each person is listed # with their first line:
rm mailmap_tmp*
cat .mailmap |grep -v "^[# ]"|grep -v "^$" | sort > mailmap_tmp1 while read <&9 line2
do
nameonly="$(echo "$line2" |awk '{NF--; print}')"
grep -m1 "$nameonly" mailmap_tmp1 >> mailmap_tmp2
done 9< "mailmap_tmp1"
cat mailmap_tmp2 |uniq > mailmap_tmp3

# find all occurences of one name
cat shortlog.txt |grep "$line" | awk '{ $1=""; print }' | sed 's/^ *//g' > currentname.txt

# get that guy alphabetically sorted into the mailmap file:
echo $line > name
cat mailmap_tmp3 name |sort > mailmap_tmp4

# find the place where we need to insert this insertbeforeline=$(cat mailmap_tmp4 |grep -A1 "$line" |tail -n1) if [ "$insertbeforeline" != "" ] ; then
# insert all in the middle of .mailmap:
while read <&9 line2; do
echo "adding line $line2 to mailmap before $insertbeforeline" sed "/$insertbeforeline/i $line2" .mailmap > mailmap_tmp5 mv mailmap_tmp5 .mailmap
done 9< "currentname.txt"
else
# must appended to end
cat currentname.txt >> .mailmap
fi

git commit -a -m "Updating .mailmap file: Adding ${line}" > /dev/null echo "---"
done < "names.txt"

rm mailmap_tmp*
rm shortlog.txt
rm names.txt

#1 lore raw
Quoted 9 lines · Stefan Beller

Hello,

I was just browsing the shortlog and it looked to me as if there are many double entries, i.e. the same person being there with multiple email addresses.

So I wrote a script, which finds double names and adds them to the .mailmap file. However manual checking, whether these are really the same person is required.

You should get together with Philipp Riemer.
http://lkml.org/lkml/2012/5/3/98

I think it's a problem not really worth solving.