Add permanent mode to git as
This commit is contained in:
parent
6b0138881c
commit
06bc34e586
1 changed files with 15 additions and 6 deletions
21
bin/git-as
21
bin/git-as
|
@ -1,9 +1,18 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
user=$1
|
user=$1
|
||||||
shift 1
|
shift 1
|
||||||
export GIT_AUTHOR_NAME="$(git config user.$user.name)"
|
if [ -z "$@" ]
|
||||||
export GIT_AUTHOR_EMAIL="$(git config user.$user.email)"
|
then
|
||||||
export GIT_COMMITTER_NAME="$(git config user.$user.name)"
|
# Run as `eval $(git as identity)` or prepend with git command
|
||||||
export GIT_COMMITTER_EMAIL="$(git config user.$user.email)"
|
echo export GIT_AUTHOR_NAME="'$(git config user.$user.name)'"
|
||||||
echo "Running as $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
|
echo export GIT_AUTHOR_EMAIL="'$(git config user.$user.email)'"
|
||||||
git "$@"
|
echo export GIT_COMMITTER_NAME="'$(git config user.$user.name)'"
|
||||||
|
echo export GIT_COMMITTER_EMAIL="'$(git config user.$user.email)'"
|
||||||
|
else
|
||||||
|
export GIT_AUTHOR_NAME="$(git config user.$user.name)"
|
||||||
|
export GIT_AUTHOR_EMAIL="$(git config user.$user.email)"
|
||||||
|
export GIT_COMMITTER_NAME="$(git config user.$user.name)"
|
||||||
|
export GIT_COMMITTER_EMAIL="$(git config user.$user.email)"
|
||||||
|
echo "Running as $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
|
||||||
|
git "$@"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue