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

[PATCH 2/2] t: git-show: adapt tests to fixed 'git show'

From
Max Kirillov <max@max630.net>
Date
May 12, 2014, 22:43 UTC
Message-ID
<20140512224343.GB32316@wheezy.local>
In-Reply-To
<20140512223517.GA32205@wheezy.local>

'git show' used to print extra newline after merge commit, and it was recorded so into the test reference data. Now when the behavior is fixed, the tests should be updated.

Note that '--format=%s' works like '--pretty=tformat:%s'. This
is why non-merging cases pass, like t3505-cherry-pick-empty.sh
for example, though they look very similarly.
---
 t/t1507-rev-parse-upstream.sh |  2 +-
 t/t7600-merge.sh              | 11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh
index 2a19e79..672280b 100755
--- a/t/t1507-rev-parse-upstream.sh
+++ b/t/t1507-rev-parse-upstream.sh
@@ -100,7 +100,7 @@ test_expect_success 'merge my-side@{u} records the correct name' '
 	git branch -D new ;# can fail but is ok
 	git branch -t new my-side@{u} &&
 	git merge -s ours new@{u} &&
-	git show -s --pretty=format:%s >actual &&
+	git show -s --pretty=tformat:%s >actual &&
 	echo "Merge remote-tracking branch ${sq}origin/side${sq}" >expect &&
 	test_cmp expect actual
 )
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 10aa028..b164621 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -57,11 +57,10 @@ create_merge_msgs () {
 		git log --no-merges ^HEAD c2 c3
 	} >squash.1-5-9 &&
 	: >msg.nologff &&
-	echo >msg.nolognoff &&
+	: >msg.nolognoff &&
 	{
 		echo "* tag 'c3':" &&
-		echo "  commit 3" &&
-		echo
+		echo "  commit 3"
 	} >msg.log
 }
 
@@ -71,7 +70,7 @@ verify_merge () {
 	git diff --exit-code &&
 	if test -n "$3"
 	then
-		git show -s --pretty=format:%s HEAD >msg.act &&
+		git show -s --pretty=tformat:%s HEAD >msg.act &&
 		test_cmp "$3" msg.act
 	fi
 }
@@ -620,10 +619,10 @@ test_expect_success 'merge early part of c2' '
 	git tag c6 &&
 	git branch -f c5-branch c5 &&
 	git merge c5-branch~1 &&
-	git show -s --pretty=format:%s HEAD >actual.branch &&
+	git show -s --pretty=tformat:%s HEAD >actual.branch &&
 	git reset --keep HEAD^ &&
 	git merge c5~1 &&
-	git show -s --pretty=format:%s HEAD >actual.tag &&
+	git show -s --pretty=tformat:%s HEAD >actual.tag &&
 	test_cmp expected.branch actual.branch &&
 	test_cmp expected.tag actual.tag
 '
-- 
1.8.5.2.421.g4cdf8d0
Previous: Max Kirillov
Message 3 of 3 in “fix 'git show -s' to not add extra terminator after merge commit”
  1. 0/2 fix 'git show -s' to not add extra terminator after merge commitMax Kirillov, May 12, 2014
  2. 1/2 git-show: fix 'git show -s' to not add extra terminator after merge commitMax Kirillov, May 12, 2014
  3. 2/2 t: git-show: adapt tests to fixed 'git show'Max Kirillov, May 12, 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.