Thierry Carrez wrote:
> Jelmer Vernooij wrote:
> 
>> This seems to implement different behaviour for bzr and git, both of
>> which support a distinction between the committer of a revision and the
>> author of that revision. The patch overrides the author for git and the
>> committer for bzr.
> 
> True :)
> 
> I should have used GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL rather
> than the GIT_AUTHOR_* counterparts.
> 
> Will post a new patch here after some tests.

Here is a new one using GIT_COMMITTER_*. It also avoids the useless copy
of $SUDO_USER into $author.

-- 
Thierry Carrez
--- commit.d/50vcs-commit	2008-12-31 18:02:14 +0000
+++ commit.d/50vcs-commit	2009-01-28 14:01:43 +0000
@@ -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_u...@$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_u...@$hostname>"
+	fi
 	if [ -n "$message" ]; then
 		bzr commit $BZR_COMMIT_OPTIONS -m "$message"
 	else

Reply via email to