Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script for git svn --authors-prog argument (author name conversion)
#!/usr/bin/env bash
# Script for converting author from SVN to Git, used as an argument for
# --authors-prog
# Example:
# "foo.bar" will be "Foo Bar <foo.bar@example.com>"
# "not-human" will be "not-human <not-human@example.com>"
set -e
EMAIL_DOMAIN=example.com
username2name() {
local username=$1
local firstname=${username%%.*}
local lastname=${username##*.}
local name="${firstname~} ${lastname~}"
if [[ "$firstname" == "$lastname" ]]; then
local name="$firstname"
fi
local email="${username}@$EMAIL_DOMAIN"
echo "$name <$email>"
}
username2name $1
@paulohy

This comment has been minimized.

Copy link

paulohy commented Aug 24, 2018

thank you so much for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.