From ab680dce2b565d285ac538fc931bd4b93beb68c8 Mon Sep 17 00:00:00 2001 From: Paul Tan Date: Mon, 15 Jun 2015 19:08:10 +0800 Subject: [PATCH] am: teach StGit patch parser how to read from stdin git-mailsplit, which splits mbox patches, will read the patch from stdin when the filename is "-" or there are no files listed on the command-line. To be consistent with this behavior, teach the StGit patch parser to read from stdin if the filename is "-" or no files are listed on the command-line. Based-on-patch-by: Chris Packham Helped-by: Junio C Hamano Signed-off-by: Paul Tan Signed-off-by: Junio C Hamano --- git-am.sh | 3 ++- t/t4150-am.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index a67d0f9898..1f4c09e3d4 100755 --- a/git-am.sh +++ b/git-am.sh @@ -297,6 +297,7 @@ split_patches () { ;; stgit) this=0 + test 0 -eq "$#" && set -- - for stgit in "$@" do this=$(expr "$this" + 1) @@ -318,7 +319,7 @@ split_patches () { print "Subject: ", $_ ; $subject = 1; } - ' < "$stgit" > "$dotest/$msgnum" || clean_abort + ' -- "$stgit" >"$dotest/$msgnum" || clean_abort done echo "$this" > "$dotest/last" this= diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 0ead529a2f..51962e481e 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -209,6 +209,16 @@ test_expect_success 'am applies stgit patch' ' test_cmp_rev second^ HEAD^ ' +test_expect_success 'am --patch-format=stgit applies stgit patch' ' + rm -fr .git/rebase-apply && + git checkout -f first && + git am --patch-format=stgit