t5551: test fetch.c:backfill_tags() code
PATCH 1/1 t5551: test fetch.c:backfill_tags() code
This makes sure the second fetch with transport helper code path is exercised in the test suite.
Signed-off-by Nguyễn Thái Ngọc Duy <[email protected]>
---
This should catch the problem by aa/transport-non-positive-depth-only. The GIT_TEST_BACKFILL_TAGS is bad but I don't know any sure way to verify it, assuming the shallow code may change in future and stop triggering backfill_tags().
builtin/fetch.c | 2 ++ t/t5551-http-fetch.sh | 16 ++++++++++++++++ 2 files changed, 18 insertions(+)
builtin/fetch.c +2 -0
@@ -750,6 +750,8 @@ static struct transport *prepare_transport(struct remote *remote)static void backfill_tags (struct transport *transport,struct ref *ref_map) { +if (getenv ("GIT_TEST_BACKFILL_TAGS" )) +fprintf (stderr,"backfill_tags executed\n" );if (transport->cannot_reuse) { gsecondary =prepare_transport (transport->remote); transport = gsecondary;
t/t5551-http-fetch.sh +16 -0
@@ -181,6 +181,22 @@ test_expect_success 'create namespaced refs' ' symbolic-ref refs/namespaces/ns/HEAD refs/namespaces/ns/refs/heads/master ' +test_expect_success 'trigger backfill_tags() over smart-http' ' + git tag -m two tag-two && + echo content >>file && + git commit -a -m three && + git push public master tag-two && + git rev-parse master tag-two >expected && + ( + git init shallow && + cd shallow && + GIT_TEST_BACKFILL_TAGS=1 git fetch --depth=2 $HTTPD_URL/smart/repo.git master:foo 2>err && + grep "backfill_tags executed" err && + git rev-parse foo tag-two >../actual + ) && + test_cmp expected actual +' + test_expect_success 'smart clone respects namespace' ' git clone "$HTTPD_URL/smart_namespace/repo.git" ns-smart && echo namespaced >expect &&
Signature · 1 line
1.8.5.1.25.g8667982