mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
am: learn passing -b to mailinfo
git-am could pass -k to mailinfo, but not -b. Introduce an option that does so. We change the meaning of the 'keep' state file, but are careful not to cause a problem unless you downgrade in the middle of an 'am' run. This uncovers a bug in mailinfo -b, hence the failing test. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
82553cbb08
commit
f7e5ea171b
|
@ -39,6 +39,9 @@ OPTIONS
|
||||||
--keep::
|
--keep::
|
||||||
Pass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
|
Pass `-k` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
|
||||||
|
|
||||||
|
--keep-non-patch::
|
||||||
|
Pass `-b` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]).
|
||||||
|
|
||||||
--keep-cr::
|
--keep-cr::
|
||||||
--no-keep-cr::
|
--no-keep-cr::
|
||||||
With `--keep-cr`, call 'git mailsplit' (see linkgit:git-mailsplit[1])
|
With `--keep-cr`, call 'git mailsplit' (see linkgit:git-mailsplit[1])
|
||||||
|
|
20
git-am.sh
20
git-am.sh
|
@ -15,6 +15,7 @@ q,quiet be quiet
|
||||||
s,signoff add a Signed-off-by line to the commit message
|
s,signoff add a Signed-off-by line to the commit message
|
||||||
u,utf8 recode into utf8 (default)
|
u,utf8 recode into utf8 (default)
|
||||||
k,keep pass -k flag to git-mailinfo
|
k,keep pass -k flag to git-mailinfo
|
||||||
|
keep-non-patch pass -b flag to git-mailinfo
|
||||||
keep-cr pass --keep-cr flag to git-mailsplit for mbox format
|
keep-cr pass --keep-cr flag to git-mailsplit for mbox format
|
||||||
no-keep-cr do not pass --keep-cr flag to git-mailsplit independent of am.keepcr
|
no-keep-cr do not pass --keep-cr flag to git-mailsplit independent of am.keepcr
|
||||||
c,scissors strip everything before a scissors line
|
c,scissors strip everything before a scissors line
|
||||||
|
@ -345,6 +346,8 @@ do
|
||||||
utf8= ;;
|
utf8= ;;
|
||||||
-k|--keep)
|
-k|--keep)
|
||||||
keep=t ;;
|
keep=t ;;
|
||||||
|
--keep-non-patch)
|
||||||
|
keep=b ;;
|
||||||
-c|--scissors)
|
-c|--scissors)
|
||||||
scissors=t ;;
|
scissors=t ;;
|
||||||
--no-scissors)
|
--no-scissors)
|
||||||
|
@ -522,16 +525,25 @@ case "$resolved" in
|
||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Now, decide what command line options we will give to the git
|
||||||
|
# commands we invoke, based on the result of parsing command line
|
||||||
|
# options and previous invocation state stored in $dotest/ files.
|
||||||
|
|
||||||
if test "$(cat "$dotest/utf8")" = t
|
if test "$(cat "$dotest/utf8")" = t
|
||||||
then
|
then
|
||||||
utf8=-u
|
utf8=-u
|
||||||
else
|
else
|
||||||
utf8=-n
|
utf8=-n
|
||||||
fi
|
fi
|
||||||
if test "$(cat "$dotest/keep")" = t
|
keep=$(cat "$dotest/keep")
|
||||||
then
|
case "$keep" in
|
||||||
keep=-k
|
t)
|
||||||
fi
|
keep=-k ;;
|
||||||
|
b)
|
||||||
|
keep=-b ;;
|
||||||
|
*)
|
||||||
|
keep= ;;
|
||||||
|
esac
|
||||||
case "$(cat "$dotest/keepcr")" in
|
case "$(cat "$dotest/keepcr")" in
|
||||||
t)
|
t)
|
||||||
keepcr=--keep-cr ;;
|
keepcr=--keep-cr ;;
|
||||||
|
|
|
@ -219,7 +219,7 @@ test_expect_success 'am stays in branch' '
|
||||||
|
|
||||||
test_expect_success 'am --signoff does not add Signed-off-by: line if already there' '
|
test_expect_success 'am --signoff does not add Signed-off-by: line if already there' '
|
||||||
git format-patch --stdout HEAD^ >patch3 &&
|
git format-patch --stdout HEAD^ >patch3 &&
|
||||||
sed -e "/^Subject/ s,\[PATCH,Re: Re: Re: & 1/5 v2," patch3 >patch4 &&
|
sed -e "/^Subject/ s,\[PATCH,Re: Re: Re: & 1/5 v2] [foo," patch3 >patch4 &&
|
||||||
rm -fr .git/rebase-apply &&
|
rm -fr .git/rebase-apply &&
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
git checkout HEAD^ &&
|
git checkout HEAD^ &&
|
||||||
|
@ -241,7 +241,17 @@ test_expect_success 'am --keep really keeps the subject' '
|
||||||
git am --keep patch4 &&
|
git am --keep patch4 &&
|
||||||
! test -d .git/rebase-apply &&
|
! test -d .git/rebase-apply &&
|
||||||
git cat-file commit HEAD >actual &&
|
git cat-file commit HEAD >actual &&
|
||||||
grep "Re: Re: Re: \[PATCH 1/5 v2\] third" actual
|
grep "Re: Re: Re: \[PATCH 1/5 v2\] \[foo\] third" actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure 'am --keep-non-patch really keeps the non-patch part' '
|
||||||
|
rm -fr .git/rebase-apply &&
|
||||||
|
git reset --hard &&
|
||||||
|
git checkout HEAD^ &&
|
||||||
|
git am --keep-non-patch patch4 &&
|
||||||
|
! test -d .git/rebase-apply &&
|
||||||
|
git cat-file commit HEAD >actual &&
|
||||||
|
grep "^\[foo\] third" actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'am -3 falls back to 3-way merge' '
|
test_expect_success 'am -3 falls back to 3-way merge' '
|
||||||
|
|
Loading…
Reference in a new issue