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

[PATCH 4/5] am: don't call mailinfo if $rebasing

From
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Date
Jun 26, 2012, 14:51 UTC
Message-ID
<1340722318-24392-5-git-send-email-martin.von.zweigbergk@gmail.com>
In-Reply-To
<1340722318-24392-1-git-send-email-martin.von.zweigbergk@gmail.com>

Since 5e835ca (rebase: do not munge commit log message, 2008-04-16), 'git am --rebasing' no longer gets the commit log message from the patch, but reads it from the commit identified by the "From " header line. From 43c2325 (am: use get_author_ident_from_commit instead of mailinfo when rebasing, 2010-06-16), it also gets the author name, email and date from the commit. Now that the final part of the patch -- the patch body itself -- is also read from the commit, there is no longer a need to call 'git mailinfo' to extract any of these parts while --rebasing.

Sugested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
---
 git-am.sh |   47 ++++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index ec8fde1..b6a5300 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -260,7 +260,7 @@ check_patch_format () {
 split_patches () {
 	case "$patch_format" in
 	mbox)
-		if test -n "$rebasing" || test t = "$keepcr"
+		if test t = "$keepcr"
 		then
 		    keep_cr=--keep-cr
 		else
@@ -413,7 +413,7 @@ do
 	--abort)
 		abort=t ;;
 	--rebasing)
-		rebasing=t threeway=t keep=t scissors=f no_inbody_headers=t ;;
+		rebasing=t threeway=t ;;
 	-d|--dotest)
 		die "$(gettext "-d option is no longer supported.  Do not use.")"
 		;;
@@ -658,33 +658,34 @@ do
 	# by the user, or the user can tell us to do so by --resolved flag.
 	case "$resume" in
 	'')
-		git mailinfo $keep $no_inbody_headers $scissors $utf8 "$dotest/msg" "$dotest/patch" \
-			<"$dotest/$msgnum" >"$dotest/info" ||
-			stop_here $this
-
-		# skip pine's internal folder data
-		sane_grep '^Author: Mail System Internal Data$' \
-			<"$dotest"/info >/dev/null &&
-			go_next && continue
-
-		test -s "$dotest/patch" || {
-			eval_gettextln "Patch is empty.  Was it split wrong?
-If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
-To restore the original branch and stop patching run \"\$cmdline --abort\"."
-			stop_here $this
-		}
-		rm -f "$dotest/original-commit" "$dotest/author-script"
-		if test -f "$dotest/rebasing" &&
+		if test -f "$dotest/rebasing"
+		then
 			commit=$(sed -e 's/^From \([0-9a-f]*\) .*/\1/' \
 				-e q "$dotest/$msgnum") &&
-			test "$(git cat-file -t "$commit")" = commit
-		then
+			test "$(git cat-file -t "$commit")" = commit ||
+				stop_here $this
 			git cat-file commit "$commit" |
 			sed -e '1,/^$/d' >"$dotest/msg-clean"
-			echo "$commit" > "$dotest/original-commit"
-			get_author_ident_from_commit "$commit" > "$dotest/author-script"
+			echo "$commit" >"$dotest/original-commit"
+			get_author_ident_from_commit "$commit" >"$dotest/author-script"
 			git diff-tree --root --binary "$commit" >"$dotest/patch"
 		else
+			git mailinfo $keep $no_inbody_headers $scissors $utf8 "$dotest/msg" "$dotest/patch" \
+				<"$dotest/$msgnum" >"$dotest/info" ||
+				stop_here $this
+
+			# skip pine's internal folder data
+			sane_grep '^Author: Mail System Internal Data$' \
+				<"$dotest"/info >/dev/null &&
+				go_next && continue
+
+			test -s "$dotest/patch" || {
+				eval_gettextln "Patch is empty.  Was it split wrong?
+If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
+To restore the original branch and stop patching run \"\$cmdline --abort\"."
+				stop_here $this
+			}
+			rm -f "$dotest/original-commit" "$dotest/author-script"
 			{
 				sed -n '/^Subject/ s/Subject: //p' "$dotest/info"
 				echo
-- 
1.7.9.3.327.g2980b
Previous: Martin von ZweigbergkNext: Martin von Zweigbergk
Message 5 of 8 in “rebase: calculate patches in upstream correctly”
  1. 0/5 rebase: calculate patches in upstream correctlyMartin von Zweigbergk, Jun 26, 2012
  2. 1/5 rebase: don't source git-sh-setup twiceMartin von Zweigbergk, Jun 26, 2012
  3. 2/5 rebase --root: print usage on too many argsMartin von Zweigbergk, Jun 26, 2012
  4. 3/5 am --rebasing: get patch body from commit, not from mailboxMartin von Zweigbergk, Jun 26, 2012
  5. 4/5 am: don't call mailinfo if $rebasingMartin von Zweigbergk, Jun 26, 2012
  6. 5/5 rebase [-m]: calculate patches in upstream correctlyMartin von Zweigbergk, Jun 26, 2012
  7. Junio C HamanoJun 26, 2012
  8. Martin von ZweigbergkJun 27, 2012

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.