]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t6022-rev-list-missing.sh
revision: fix --missing=[print|allow*] for annotated tags
[thirdparty/git.git] / t / t6022-rev-list-missing.sh
index 78387eebb3fcb0e6fb896a7b61f638c56c157ee9..127180e1c9a246769fb5bb7ede57f814abb4fc79 100755 (executable)
@@ -10,7 +10,10 @@ TEST_PASSES_SANITIZE_LEAK=true
 test_expect_success 'create repository and alternate directory' '
        test_commit 1 &&
        test_commit 2 &&
-       test_commit 3
+       test_commit 3 &&
+       git tag -m "tag message" annot_tag HEAD~1 &&
+       git tag regul_tag HEAD~1 &&
+       git branch a_branch HEAD~1
 '
 
 # We manually corrupt the repository, which means that the commit-graph may
@@ -78,7 +81,7 @@ do
        done
 done
 
-for missing_tip in "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t"
+for missing_tip in "annot_tag" "regul_tag" "a_branch" "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t"
 do
        # We want to check that things work when both
        #   - all the tips passed are missing (case existing_tip = ""), and
@@ -88,9 +91,6 @@ do
                for action in "allow-any" "print"
                do
                        test_expect_success "--missing=$action with tip '$missing_tip' missing and tip '$existing_tip'" '
-                               oid="$(git rev-parse $missing_tip)" &&
-                               path=".git/objects/$(test_oid_to_path $oid)" &&
-
                                # Before the object is made missing, we use rev-list to
                                # get the expected oids.
                                if test "$existing_tip" = "HEAD"
@@ -109,11 +109,23 @@ do
                                        echo $(git rev-parse HEAD:2.t) >>expect.raw
                                fi &&
 
+                               missing_oid="$(git rev-parse $missing_tip)" &&
+
+                               if test "$missing_tip" = "annot_tag"
+                               then
+                                       oid="$(git rev-parse $missing_tip^{commit})" &&
+                                       echo "$missing_oid" >>expect.raw
+                               else
+                                       oid="$missing_oid"
+                               fi &&
+
+                               path=".git/objects/$(test_oid_to_path $oid)" &&
+
                                mv "$path" "$path.hidden" &&
                                test_when_finished "mv $path.hidden $path" &&
 
                                git rev-list --missing=$action --objects --no-object-names \
-                                    $oid $existing_tip >actual.raw &&
+                                    $missing_oid $existing_tip >actual.raw &&
 
                                # When the action is to print, we should also add the missing
                                # oid to the expect list.