Skip to content

Commit 76c9c0d

Browse files
committed
rebase -i: Export GIT_AUTHOR_* variables explicitly
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 <[email protected]>
1 parent dd8a8d4 commit 76c9c0d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

git-rebase--interactive.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ has_action () {
215215
# Run command with GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
216216
# GIT_AUTHOR_DATE exported from the current environment.
217217
do_with_author () {
218-
GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
219-
GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
220-
GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
221-
"$@"
218+
(
219+
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
220+
"$@"
221+
)
222222
}
223223

224224
pick_one () {

0 commit comments

Comments
 (0)