Skip to content

Commit 458a7e5

Browse files
peffgitster
authored andcommitted
t5516: test pushing a tag of an otherwise unreferenced blob
It's not unreasonable to have a tag that points to a blob that is not part of the normal history. We do this in git.git to distribute gpg keys. However, we never explicitly checked in our test suite that this actually works (i.e., that pack-objects actually sends the blob because of the tag mentioning it). It does in fact work fine, but a recent patch under discussion broke this, and the test suite didn't notice. Let's make the test suite more complete. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2073949 commit 458a7e5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

t/t5516-fetch-push.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,4 +1277,17 @@ EOF
12771277
git push --no-thin --receive-pack="$rcvpck" no-thin/.git refs/heads/master:refs/heads/foo
12781278
'
12791279

1280+
test_expect_success 'pushing a tag pushes the tagged object' '
1281+
rm -rf dst.git &&
1282+
blob=$(echo unreferenced | git hash-object -w --stdin) &&
1283+
git tag -m foo tag-of-blob $blob &&
1284+
git init --bare dst.git &&
1285+
git push dst.git tag-of-blob &&
1286+
# the receiving index-pack should have noticed
1287+
# any problems, but we double check
1288+
echo unreferenced >expect &&
1289+
git --git-dir=dst.git cat-file blob tag-of-blob >actual &&
1290+
test_cmp expect actual
1291+
'
1292+
12801293
test_done

0 commit comments

Comments
 (0)