git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: git@vger.kernel.org, gitster@pobox.com
Subject: [PATCH 5/5] rebase -i: avoid exporting GIT_AUTHOR_* variables
Date: Tue, 25 Sep 2007 16:43:44 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0709251643310.28395@racer.site> (raw)
In-Reply-To: <Pine.LNX.4.64.0709251640360.28395@racer.site>


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>
---
 git-rebase--interactive.sh |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 445a299..e3e89dd 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -174,7 +174,11 @@ pick_one_preserving_merges () {
 			eval "$author_script"
 			msg="$(git cat-file commit $sha1 | sed -e '1,/^$/d')"
 			# NEEDSWORK: give rerere a chance
-			if ! output git merge $STRATEGY -m "$msg" $new_parents
+			if ! GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
+				GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
+				GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
+				output git merge $STRATEGY -m "$msg" \
+					$new_parents
 			then
 				printf "%s\n" "$msg" > "$GIT_DIR"/MERGE_MSG
 				die Error redoing merge $sha1
@@ -281,7 +285,9 @@ do_next () {
 		f)
 			# This is like --amend, but with a different message
 			eval "$author_script"
-			export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
+			GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
+			GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
+			GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" \
 			$USE_OUTPUT git commit -F "$MSG" $EDIT_COMMIT
 			;;
 		t)
-- 
1.5.3.2.1057.gf4dc1

  parent reply	other threads:[~2007-09-25 15:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25 15:42 [PATCH 0/5] Two real fixes, two minor fixes, and a style fix Johannes Schindelin
2007-09-25 15:42 ` [PATCH 1/5] rebase -i: commit when continuing after "edit" Johannes Schindelin
2007-09-25 15:42 ` [PATCH 2/5] rebase -i: style fixes and minor cleanups Johannes Schindelin
2007-09-25 15:43 ` [PATCH 3/5] rebase -i: Fix numbers in progress report Johannes Schindelin
2007-09-25 15:43 ` [PATCH 4/5] rebase -i: work on a detached HEAD Johannes Schindelin
2007-09-25 15:43 ` Johannes Schindelin [this message]
2007-09-26 10:33   ` [PATCH 5/5] rebase -i: avoid exporting GIT_AUTHOR_* variables Johannes Sixt
2007-09-26 10:51     ` Johannes Schindelin
     [not found]     ` <86zlz9smqr.fsf@lola.quinscape.zz>
2007-09-26 11:18       ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0709251643310.28395@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).