Imported Upstream version 2.27.0
[platform/upstream/git.git] / t / t5616-partial-clone.sh
index 77bb91e..8a27452 100755 (executable)
@@ -49,7 +49,7 @@ test_expect_success 'do partial clone 1' '
 test_expect_success 'verify that .promisor file contains refs fetched' '
        ls pc1/.git/objects/pack/pack-*.promisor >promisorlist &&
        test_line_count = 1 promisorlist &&
-       git -C srv.bare rev-list HEAD >headhash &&
+       git -C srv.bare rev-parse --verify HEAD >headhash &&
        grep "$(cat headhash) HEAD" $(cat promisorlist) &&
        grep "$(cat headhash) refs/heads/master" $(cat promisorlist)
 '
@@ -384,12 +384,11 @@ test_expect_success 'fetch lazy-fetches only to resolve deltas, protocol v2' '
        grep "want $(cat hash)" trace
 '
 
-# The following two tests must be in this order, or else
-# the first will not fail. It is important that the srv.bare
-# repository did not have tags during clone, but has tags
+# The following two tests must be in this order. It is important that
+# the srv.bare repository did not have tags during clone, but has tags
 # in the fetch.
 
-test_expect_failure 'verify fetch succeeds when asking for new tags' '
+test_expect_success 'verify fetch succeeds when asking for new tags' '
        git clone --filter=blob:none "file://$(pwd)/srv.bare" tag-test &&
        for i in I J K
        do
@@ -415,6 +414,14 @@ test_expect_success 'verify fetch downloads only one pack when updating refs' '
        test_line_count = 3 pack-list
 '
 
+test_expect_success 'single-branch tag following respects partial clone' '
+       git clone --single-branch -b B --filter=blob:none \
+               "file://$(pwd)/srv.bare" single &&
+       git -C single rev-parse --verify refs/tags/B &&
+       git -C single rev-parse --verify refs/tags/A &&
+       test_must_fail git -C single rev-parse --verify refs/tags/C
+'
+
 . "$TEST_DIRECTORY"/lib-httpd.sh
 start_httpd