diff --git a/README.md b/README.md index f410923..abb8ae3 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ To find all options use: gits --help -The first time you use gits it will prompt for git usernames and emails for the pair of developers. This is stored in ~/.gits and this file can safely removed to reset pairing. +The first time you use gits it will prompt for git usernames (spaces are allowed) and emails for the pair of developers. This is stored in ~/.gits and this file can safely removed to reset pairing. Although you only need to use gits when committing to repositories, you can use it instead of git for all operations if you prefer. @@ -23,6 +23,6 @@ If you want to take the random element out of a commit you can force the author ## Installation ### Manual Installation - $ sudo wget https://raw.github.com/roylines/gits/master/gits.sh -O /usr/local/bin/gits - $ sudo chmod ugo+x /usr/local/bin/gits - $ gits \ No newline at end of file + $ wget https://raw.github.com/roylines/gits/master/gits.sh -O /usr/local/bin/gits + $ chmod ugo+x /usr/local/bin/gits + $ gits diff --git a/gits.sh b/gits.sh index d235fea..9bf245a 100755 --- a/gits.sh +++ b/gits.sh @@ -14,8 +14,10 @@ then echo "Please enter the second pair email > " read email2 - echo "$username1 $email1" > $config - echo "$username2 $email2" >> $config + echo "$username1" > $config + echo "$email1" >> $config + echo "$username2" >> $config + echo "$email2" >> $config echo "created config for: $username1 ($email1), $username2 ($email2)" exit 0 @@ -28,14 +30,19 @@ if [ $1 = "1" ]; then echo 'forcing author to first user' shift + n=1 fi if [ $1 = "2" ]; then echo 'forcing author to second user' shift + n=2 fi +old_IFS=$IFS +IFS=$'\n' + filecontent=( `cat "$config" `) if [ $n -eq 1 ] then @@ -50,6 +57,9 @@ else export GIT_AUTHOR_EMAIL=${filecontent[1]} fi +IFS=$old_IFS + git "$@" -echo "commit: $GIT_COMMITTER_NAME, author: $GIT_AUTHOR_NAME" +echo "commit name: $GIT_COMMITTER_NAME, email: $GIT_COMMITTER_EMAIL" +echo "author name: $GIT_AUTHOR_NAME, email: $GIT_AUTHOR_EMAIL"