]> Pileus Git - ~andy/git/commitdiff
rebase -i: Export GIT_AUTHOR_* variables explicitly
authorJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2010 21:09:24 +0000 (13:09 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 Jan 2010 05:39:11 +0000 (21:39 -0800)
There is no point doing self-assignments of these variables.  Instead,
just export them to the environment, but do so in a sub-shell, because

VAR1=VAL1 VAR2=VAL2 ... command arg1 arg2...

does not mark the variables exported if command that is run
is a shell function, according to POSIX.1.

The callers of do_with_author do not rely on seeing the effect of any
shell variable assignments that may happen inside what was called through
this shell function (currently "output" is the only one), so running it in
the subshell doesn't have an adverse semantic effect.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--interactive.sh

index c2f6089de8dd74f9740d0ca4c5225248ec1bc1e7..9187e9bdba4792ab9d0f5532128ff87e9329ab1e 100755 (executable)
@@ -215,10 +215,10 @@ has_action () {
 # Run command with GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
 # GIT_AUTHOR_DATE exported from the current environment.
 do_with_author () {
-       GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
-       GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
-       GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
-       "$@"
+       (
+               export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
+               "$@"
+       )
 }
 
 pick_one () {