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

[RFC PATCHv3 2/4] t/am: add test for stgit patch format

From
Chris Packham <judge.packham@gmail.com>
Date
Sep 5, 2014, 10:06 UTC
Message-ID
<1409911611-20370-3-git-send-email-judge.packham@gmail.com>
In-Reply-To
<1409911611-20370-1-git-send-email-judge.packham@gmail.com>

This adds a tests which exercise the detection of the stgit format. There is a current know breakage in that the code that deals with stgit in split_patches can't handle reading from stdin.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
 t/t4150-am.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 5edb79a..dbe3475 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -103,6 +103,15 @@ test_expect_success setup '
 		echo "X-Fake-Field: Line Three" &&
 		git format-patch --stdout first | sed -e "1d"
 	} > patch1-ws.eml &&
+	{
+		echo "From: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" &&
+		echo &&
+		cat msg &&
+		echo &&
+		echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" &&
+		echo "---" &&
+		git diff-tree --stat -p second | sed -e "1d"
+	} > patch1-stgit.eml &&
 
 	sed -n -e "3,\$p" msg >file &&
 	git add file &&
@@ -186,6 +195,24 @@ test_expect_success 'am applies patch e-mail with preceding whitespace' '
 	test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
 '
 
+test_expect_success 'am applies patch generated by stgit' '
+	rm -fr .git/rebase-apply &&
+	git reset --hard &&
+	git checkout first &&
+	git am patch1-stgit.eml &&
+	test_path_is_missing .git/rebase-apply &&
+	git diff --exit-code second
+'
+
+test_expect_failure 'am applies patch using --patch-format=stgit' '
+	rm -fr .git/rebase-apply &&
+	git reset --hard &&
+	git checkout first &&
+	git am --patch-format=stgit <patch1-stgit.eml &&
+	test_path_is_missing .git/rebase-apply &&
+	git diff --exit-code second
+'
+
 test_expect_success 'setup: new author and committer' '
 	GIT_AUTHOR_NAME="Another Thor" &&
 	GIT_AUTHOR_EMAIL="a.thor@example.com" &&
-- 
2.1.0.64.gc343089
Previous: Torsten BögershausenNext: Chris Packham
Message 11 of 13 in “[RFC PATCHv3 0/4] am: patch-format”
  1. Chris PackhamSep 5, 2014
  2. 1/4 am: avoid re-directing stdin twiceChris Packham, Sep 5, 2014
  3. Johannes SixtSep 5, 2014
  4. Chris PackhamSep 5, 2014
  5. Junio C HamanoSep 5, 2014
  6. Junio C HamanoSep 5, 2014
  7. Junio C HamanoSep 5, 2014
  8. Stephen BoydSep 5, 2014
  9. Junio C HamanoSep 6, 2014
  10. Torsten BögershausenSep 6, 2014
  11. 2/4 t/am: add test for stgit patch formatChris Packham, Sep 5, 2014
  12. 3/4 t/am: add tests for hg patch formatChris Packham, Sep 5, 2014
  13. 4/4 am: add gitk patch formatChris Packham, Sep 5, 2014

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.