]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5516: beef up exact-oid ref prefixes test
authorJeff King <peff@peff.net>
Sun, 9 Mar 2025 03:02:47 +0000 (22:02 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Mar 2025 20:13:45 +0000 (13:13 -0700)
Commit 6c301adb0a (fetch: do not pass ref-prefixes for fetch by exact
SHA1, 2018-05-31) added a test that fetching an exact oid with the v2
protocol works. Originally it failed without the code change from that
commit, because fetch failed with "no matching remote head".

That changed in 0177565148 (transport: do not list refs if possible,
2018-09-27), which made fetch more forgiving of this case.

But that now meant the test passes even without its fix! So let's also
have it check the packet listing to make sure we did not ask for the
bogus prefix (ultimately this is less important than whether the command
fails, since it's just an optimization, but we should make sure not to
regress it).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5516-fetch-push.sh

index e4008f3ca62059f342bf4b12717c81923ac39b15..2904399e97768e0550191d6a288e5fddd1d3bcaf 100755 (executable)
@@ -1312,7 +1312,10 @@ test_expect_success 'fetch exact oid in protocol v2' '
        test_must_fail git -C child cat-file -t $the_commit &&
 
        # fetching the hidden object succeeds by default
-       git -C child fetch -v ../testrepo $the_commit:refs/heads/copy
+       GIT_TRACE_PACKET=$PWD/trace.out \
+       git -C child fetch -v ../testrepo $the_commit:refs/heads/copy &&
+
+       test_grep ! "ref-prefix.*$the_commit" trace.out
 '
 
 for configallowtipsha1inwant in true false