Skip to content

Instantly share code, notes, and snippets.

@liskin
Created October 22, 2021 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liskin/7b78eba396024d4f56fa217867e2a3a8 to your computer and use it in GitHub Desktop.
Save liskin/7b78eba396024d4f56fa217867e2a3a8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -eu -o pipefail
shopt -s lastpipe
repo=~/src-haskell/xmonad-tmp
function mailmap-diff {
diff -au \
<(cd "$repo"; git shortlog --summary --email) \
<((cd "$repo"; git log --pretty=short --no-mailmap) | (git shortlog --summary --email))
}
sedscript=''
wc -l "$repo"/.mailmap | read -r lines _
for l in $(seq 1 $lines); do
sedscript2="${sedscript}${l}d;"
sed -e "$sedscript2" <"$repo"/.mailmap >.mailmap
if mailmap-diff >/dev/null; then
sedscript="$sedscript2"
fi
done
sed -e "$sedscript" <"$repo"/.mailmap >.mailmap-clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment