am: don't call mailinfo if $rebasing

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin von Zweigbergk committed Jun 26, 2012 at 07:51 UTC 0fbb95dc83c80fa12f731e703e88e61d9391abd5
1 file changed +24 -23
git-am.sh
+24 -23
@@ -260,7 +260,7 @@ check_patch_format () {
260 split_patches () {
261 case "$patch_format" in
262 mbox)
263 - if test -n "$rebasing" || test t = "$keepcr"
263 + if test t = "$keepcr"
264 then
265 keep_cr=--keep-cr
266 else
@@ -413,7 +413,7 @@ do
413 --abort)
414 abort=t ;;
415 --rebasing)
416 - rebasing=t threeway=t keep=t scissors=f no_inbody_headers=t ;;
416 + rebasing=t threeway=t ;;
417 -d|--dotest)
418 die "$(gettext "-d option is no longer supported. Do not use.")"
419 ;;
@@ -658,33 +658,34 @@ do
658 # by the user, or the user can tell us to do so by --resolved flag.
659 case "$resume" in
660 '')
661 - git mailinfo $keep $no_inbody_headers $scissors $utf8 "$dotest/msg" "$dotest/patch" \
662 - <"$dotest/$msgnum" >"$dotest/info" ||
663 - stop_here $this
664 -
665 - # skip pine's internal folder data
666 - sane_grep '^Author: Mail System Internal Data$' \
667 - <"$dotest"/info >/dev/null &&
668 - go_next && continue
669 -
670 - test -s "$dotest/patch" || {
671 - eval_gettextln "Patch is empty. Was it split wrong?
672 -If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
673 -To restore the original branch and stop patching run \"\$cmdline --abort\"."
674 - stop_here $this
675 - }
676 - rm -f "$dotest/original-commit" "$dotest/author-script"
677 - if test -f "$dotest/rebasing" &&
661 + if test -f "$dotest/rebasing"
662 + then
663 commit=$(sed -e 's/^From \([0-9a-f]*\) .*/\1/' \
664 -e q "$dotest/$msgnum") &&
680 - test "$(git cat-file -t "$commit")" = commit
681 - then
665 + test "$(git cat-file -t "$commit")" = commit ||
666 + stop_here $this
667 git cat-file commit "$commit" |
668 sed -e '1,/^$/d' >"$dotest/msg-clean"
684 - echo "$commit" > "$dotest/original-commit"
685 - get_author_ident_from_commit "$commit" > "$dotest/author-script"
669 + echo "$commit" >"$dotest/original-commit"
670 + get_author_ident_from_commit "$commit" >"$dotest/author-script"
671 git diff-tree --root --binary "$commit" >"$dotest/patch"
672 else
673 + git mailinfo $keep $no_inbody_headers $scissors $utf8 "$dotest/msg" "$dotest/patch" \
674 + <"$dotest/$msgnum" >"$dotest/info" ||
675 + stop_here $this
676 +
677 + # skip pine's internal folder data
678 + sane_grep '^Author: Mail System Internal Data$' \
679 + <"$dotest"/info >/dev/null &&
680 + go_next && continue
681 +
682 + test -s "$dotest/patch" || {
683 + eval_gettextln "Patch is empty. Was it split wrong?
684 +If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
685 +To restore the original branch and stop patching run \"\$cmdline --abort\"."
686 + stop_here $this
687 + }
688 + rm -f "$dotest/original-commit" "$dotest/author-script"
689 {
690 sed -n '/^Subject/ s/Subject: //p' "$dotest/info"
691 echo