summaryrefslogtreecommitdiff
path: root/commit.d
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-01-28 13:37:18 -0500
committerJoey Hess <joey@gnu.kitenet.net>2009-01-28 13:37:18 -0500
commitcc9462f7f8263ef5adfbeff2fb936bb36b504cba (patch)
tree17342363be1282317de43527953e4e8bef65a2dc /commit.d
parent76dc563df1afffe55a516714577dafcfb09952bb (diff)
Use SUDO_USER as the committer if set. Closes: #498739 (Thierry Carrez)
Diffstat (limited to 'commit.d')
-rwxr-xr-xcommit.d/50vcs-commit11
1 files changed, 11 insertions, 0 deletions
diff --git a/commit.d/50vcs-commit b/commit.d/50vcs-commit
index 86fe8fb..8a0c0b6 100755
--- a/commit.d/50vcs-commit
+++ b/commit.d/50vcs-commit
@@ -2,20 +2,31 @@
set -e
message="$1"
+hostname=`hostname -f`
if [ "$VCS" = git ] && [ -d .git ]; then
+ if [ -n "$SUDO_USER" ]; then
+ export GIT_COMMITTER_NAME="$SUDO_USER"
+ export GIT_COMMITTER_EMAIL="$SUDO_USER@$hostname"
+ fi
if [ -n "$message" ]; then
git commit $GIT_COMMIT_OPTIONS -m "$message"
else
git commit $GIT_COMMIT_OPTIONS
fi
elif [ "$VCS" = hg ] && [ -d .hg ]; then
+ if [ -n "$SUDO_USER" ]; then
+ export LOGNAME="$SUDO_USER"
+ fi
if [ -n "$message" ]; then
hg commit $HG_COMMIT_OPTIONS -m "$message"
else
hg commit $HG_COMMIT_OPTIONS
fi
elif [ "$VCS" = bzr ] && [ -d .bzr ]; then
+ if [ -n "$SUDO_USER" ]; then
+ export EMAIL="$SUDO_USER <$SUDO_USER@$hostname>"
+ fi
if [ -n "$message" ]; then
bzr commit $BZR_COMMIT_OPTIONS -m "$message"
else