[PATCH v2 5/8] branch tests: assert lookup_commit_reference_gently() error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Assert the exact error returned by lookup_commit_reference_gently()
and "branch' itself in the non-quiet mode invoked by branch.c (via
parse_opt_commits()). This will be used to assert a subsequent change
that changes the lookup_commit_reference_gently() code.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 t/t3201-branch-contains.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh
index 349a810cee..5bd4b05b6e 100755
--- a/t/t3201-branch-contains.sh
+++ b/t/t3201-branch-contains.sh
@@ -166,7 +166,13 @@ test_expect_success 'implicit --list conflicts with modification options' '
 '
 
 test_expect_success 'Assert that --contains only works on commits, not trees & blobs' '
-	test_must_fail git branch --contains main^{tree} &&
+	tree=$(git rev-parse main^{tree}) &&
+	test_must_fail git branch --contains main^{tree} 2>actual &&
+	cat >expect <<-EOF &&
+	error: object $tree is a tree, not a commit
+	error: no such commit main^{tree}
+	EOF
+	test_cmp expect actual &&
 	blob=$(git hash-object -w --stdin <<-\EOF
 	Some blob
 	EOF
-- 
2.31.1.723.ga5d7868e4a




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux