]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ref-filter: add test for --contains on a non-commit
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 23 Mar 2017 13:05:18 +0000 (13:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Mar 2017 17:02:55 +0000 (10:02 -0700)
Change the tag test suite to test for --contains on a tree & blob. It
only accepts commits and will spew out "<object> is a tree, not a
commit".

It's sufficient to test this just for the "tag" and "branch" commands,
because it covers all the machinery shared between "branch" and
"for-each-ref".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3201-branch-contains.sh
t/t7004-tag.sh

index 7f3ec47241cd6af7a1c107cba114decaa87df108..daa3ae82b71228edd7c6b484cfa5599ebd4803b0 100755 (executable)
@@ -130,6 +130,15 @@ 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 master^{tree} &&
+       blob=$(git hash-object -w --stdin <<-\EOF
+       Some blob
+       EOF
+       ) &&
+       test_must_fail git branch --contains $blob
+'
+
 # We want to set up a case where the walk for the tracking info
 # of one branch crosses the tip of another branch (and make sure
 # that the latter walk does not mess up our flag to see if it was
index 45790664c1b368a9cc332ea991cb9085de301351..3439913488d19fbdf13bd4ea2150a037317e7825 100755 (executable)
@@ -1461,7 +1461,9 @@ test_expect_success 'mixing incompatibles modes and options is forbidden' '
        test_must_fail git tag -n 100 &&
        test_must_fail git tag -l -m msg &&
        test_must_fail git tag -l -F some file &&
-       test_must_fail git tag -v -s
+       test_must_fail git tag -v -s &&
+       test_must_fail git tag --contains tag-tree &&
+       test_must_fail git tag --contains tag-blob
 '
 
 # check points-at