@matheusbsbs / matheus-bagliano / commits / ae830ed7f5
Fork 0

rebase -i: avoid exporting GIT_AUTHOR_* variables

It is somewhat unsafe to export the GIT_AUTHOR_* variables, since a later call to git-commit or git-merge could pick them up inadvertently. So avoid the export, using a recipe provided by Johannes Sixt. Incidentally, this fixes authorship of merges with "rebase --preserve -i". Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Sep 25, 2007 at 16:43 UTC ae830ed7f50377e64b774ce87441ff4538f04ad7
1 file changed +8 -2
git-rebase--interactive.sh
+8 -2
@@ -174,7 +174,11 @@ pick_one_preserving_merges () {
174 eval "$author_script"
175 msg="$(git cat-file commit $sha1 | sed -e '1,/^$/d')"
176 # NEEDSWORK: give rerere a chance
177 - if ! output git merge $STRATEGY -m "$msg" $new_parents
177 + if ! GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
178 + GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
179 + GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
180 + output git merge $STRATEGY -m "$msg" \
181 + $new_parents
182 then
183 printf "%s\n" "$msg" > "$GIT_DIR"/MERGE_MSG
184 die Error redoing merge $sha1
@@ -281,7 +285,9 @@ do_next () {
285 f)
286 # This is like --amend, but with a different message
287 eval "$author_script"
284 - export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
288 + GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
289 + GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
290 + GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
291 $USE_OUTPUT git commit -F "$MSG" $EDIT_COMMIT
292 ;;
293 t)