#! /bin/bash
THIS_SCRIPT=`readlink -f $0`
SCRIPT_PATH=`dirname $THIS_SCRIPT`
MATCH_LINE=`grep -m 1 ^$* $SCRIPT_PATH/../submods/gitscripts/hooks/users.txt`
if [ -n "$MATCH_LINE" ]
then
    set -- $MATCH_LINE
    if [ -n $2 -a -n -$3 ]
    then
        shift
        git config user.email $1
        if [ $? -eq 0 ]
        then
            shift
            FOO="$@"
            git config --replace-all user.name "$FOO"
            if [ $? -eq 0 ]
            then
                exit 0
            fi
        fi
    fi
fi

echo "Error: Couldn't set user config for user $*"
