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>
This commit is contained in:
Martin von Zweigbergk 2012-06-26 07:51:57 -07:00 committed by Junio C Hamano
parent a230949409
commit 0fbb95dc83

View File

@ -260,7 +260,7 @@ check_patch_format () {
split_patches () { split_patches () {
case "$patch_format" in case "$patch_format" in
mbox) mbox)
if test -n "$rebasing" || test t = "$keepcr" if test t = "$keepcr"
then then
keep_cr=--keep-cr keep_cr=--keep-cr
else else
@ -413,7 +413,7 @@ do
--abort) --abort)
abort=t ;; abort=t ;;
--rebasing) --rebasing)
rebasing=t threeway=t keep=t scissors=f no_inbody_headers=t ;; rebasing=t threeway=t ;;
-d|--dotest) -d|--dotest)
die "$(gettext "-d option is no longer supported. Do not use.")" 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. # by the user, or the user can tell us to do so by --resolved flag.
case "$resume" in case "$resume" in
'') '')
git mailinfo $keep $no_inbody_headers $scissors $utf8 "$dotest/msg" "$dotest/patch" \ if test -f "$dotest/rebasing"
<"$dotest/$msgnum" >"$dotest/info" || then
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" &&
commit=$(sed -e 's/^From \([0-9a-f]*\) .*/\1/' \ commit=$(sed -e 's/^From \([0-9a-f]*\) .*/\1/' \
-e q "$dotest/$msgnum") && -e q "$dotest/$msgnum") &&
test "$(git cat-file -t "$commit")" = commit test "$(git cat-file -t "$commit")" = commit ||
then stop_here $this
git cat-file commit "$commit" | git cat-file commit "$commit" |
sed -e '1,/^$/d' >"$dotest/msg-clean" sed -e '1,/^$/d' >"$dotest/msg-clean"
echo "$commit" > "$dotest/original-commit" echo "$commit" >"$dotest/original-commit"
get_author_ident_from_commit "$commit" > "$dotest/author-script" get_author_ident_from_commit "$commit" >"$dotest/author-script"
git diff-tree --root --binary "$commit" >"$dotest/patch" git diff-tree --root --binary "$commit" >"$dotest/patch"
else 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" sed -n '/^Subject/ s/Subject: //p' "$dotest/info"
echo echo