All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Beller <stefanbeller@googlemail.com>
To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Updating the .mailmap file
Date: Sat, 01 Dec 2012 19:50:02 +0100	[thread overview]
Message-ID: <50BA515A.3020200@googlemail.com> (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

             reply	other threads:[~2012-12-01 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-01 18:50 Stefan Beller [this message]
2012-12-02  3:11 ` Updating the .mailmap file Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50BA515A.3020200@googlemail.com \
    --to=stefanbeller@googlemail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.