git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/4] git-am --whitespace: do not lose the command line option

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 5, 2008, 02:22 UTC
Message-ID
<1228443780-3386-2-git-send-email-gitster@pobox.com>
In-Reply-To
<1228443780-3386-1-git-send-email-gitster@pobox.com>

When you start "git am --whitespace=fix" and the patch application process is interrupted by an unapplicable patch early in the series, after fixing the offending patch, the remainder of the patch should be processed still with --whitespace=fix when restarted with "git am --resolved" (or dropping the offending patch with "git am --skip").

The breakage was introduced by the commit 67dad68 (add -C[NUM] to git-am, 2007-02-08); this should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-am.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index aa60261..1bf70d4 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -121,7 +121,7 @@ It does not apply to blobs recorded in its index."
 
 prec=4
 dotest="$GIT_DIR/rebase-apply"
-sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
+sign= utf8=t keep= skip= interactive= resolved= rebasing= abort= ws=
 resolvemsg= resume=
 git_apply_opt=
 
@@ -156,7 +156,7 @@ do
 	--resolvemsg)
 		shift; resolvemsg=$1 ;;
 	--whitespace)
-		git_apply_opt="$git_apply_opt $1=$2"; shift ;;
+		ws="--whitespace=$2"; shift ;;
 	-C|-p)
 		git_apply_opt="$git_apply_opt $1$2"; shift ;;
 	--)
@@ -283,7 +283,7 @@ if test "$(cat "$dotest/keep")" = t
 then
 	keep=-k
 fi
-ws=`cat "$dotest/whitespace"`
+ws=$(cat "$dotest/whitespace")
 if test "$(cat "$dotest/sign")" = t
 then
 	SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e '
@@ -454,7 +454,7 @@ do
 
 	case "$resolved" in
 	'')
-		git apply $git_apply_opt --index "$dotest/patch"
+		git apply $git_apply_opt $ws --index "$dotest/patch"
 		apply_status=$?
 		;;
 	t)
-- 
1.6.1.rc1.60.g1d1d7

 
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 7 in “Fix longstanding "git am" bug”
  1. 0/4 Fix longstanding "git am" bugJunio C Hamano, Dec 5, 2008
  2. 1/4 git-am --whitespace: do not lose the command line optionJunio C Hamano, Dec 5, 2008
  3. 2/4 git-am: propagate -C<n>, -p<n> options as wellJunio C Hamano, Dec 5, 2008
  4. 3/4 git-am: propagate --3way options as wellJunio C Hamano, Dec 5, 2008
  5. 4/4 Test that git-am does not lose -C/-p/--whitespace optionsJunio C Hamano, Dec 5, 2008
  6. Johannes SchindelinDec 5, 2008
  7. Junio C HamanoDec 5, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.