[PATCH v2 5/8] branch tests: assert lookup_commit_reference_gently() error
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Apr 20, 2021, 13:36 UTC
- Message-ID
- <patch-5.8-8982c42127-20210420T133218Z-avarab@gmail.com>
- In-Reply-To
- <cover-0.8-0000000000-20210420T133218Z-avarab@gmail.com>
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@gmail.com> --- 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