summaryrefslogtreecommitdiff
path: root/commit.d
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2011-02-20 11:02:33 -0800
committerJoey Hess <joey@kitenet.net>2011-02-20 15:21:14 -0400
commit754e68fb2562468dcf5f497df869ced5eb819742 (patch)
tree7f4e9936450e2c9c428861ef4f217ff20370da9d /commit.d
parent9b588106d2c3e79a888b61415e084fb093a25090 (diff)
Only set environment variables for commit authorship (EMAIL, GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_EMAIL) if they don't already exist.
Diffstat (limited to 'commit.d')
-rwxr-xr-xcommit.d/50vcs-commit14
1 files changed, 10 insertions, 4 deletions
diff --git a/commit.d/50vcs-commit b/commit.d/50vcs-commit
index 6e509e6..d484626 100755
--- a/commit.d/50vcs-commit
+++ b/commit.d/50vcs-commit
@@ -41,9 +41,15 @@ fi
if [ "$VCS" = git ] && [ -d .git ]; then
if [ -n "$USER" ]; then
- export GIT_AUTHOR_NAME="$USER"
- export GIT_AUTHOR_EMAIL="$USER@$hostname"
- export GIT_COMMITTER_EMAIL=`whoami`"@$hostname"
+ if [ -z "$GIT_AUTHOR_NAME" ]; then
+ export GIT_AUTHOR_NAME="$USER"
+ fi
+ if [ -z "$GIT_AUTHOR_EMAIL" ]; then
+ export GIT_AUTHOR_EMAIL="$USER@$hostname"
+ fi
+ if [ -z "$GIT_COMMITTER_EMAIL" ]; then
+ export GIT_COMMITTER_EMAIL=`whoami`"@$hostname"
+ fi
fi
if [ -n "$logfile" ]; then
git commit $GIT_COMMIT_OPTIONS -F "$logfile"
@@ -63,7 +69,7 @@ elif [ "$VCS" = hg ] && [ -d .hg ]; then
hg commit $HG_COMMIT_OPTIONS
fi
elif [ "$VCS" = bzr ] && [ -d .bzr ]; then
- if [ -n "$USER" ]; then
+ if [ -z "$EMAIL" ] && [ -n "$USER" ]; then
export EMAIL="$USER <$USER@$hostname>"
fi
if [ -n "$logfile" ]; then