{"thread":{"id":"35482","subject":"[PATCH] t5551: test fetch.c:backfill_tags() code","startedAt":"2013-12-05T03:34:00Z","lastAt":"2013-12-05T03:34:00Z","messageCount":1,"participants":["Nguyễn Thái Ngọc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"231571","messageId":"1386214440-16560-1-git-send-email-pclouds@gmail.com","threadId":"35482","inReplyTo":null,"subject":"[PATCH] t5551: test fetch.c:backfill_tags() code","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-12-05T03:34:00Z","receivedAt":"2013-12-05T03:34:00Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This makes sure the second fetch with transport helper code path is\nexercised in the test suite.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n This should catch the problem by aa/transport-non-positive-depth-only.\n The GIT_TEST_BACKFILL_TAGS is bad but I don't know any sure way to\n verify it, assuming the shallow code may change in future and stop\n triggering backfill_tags().\n\n builtin/fetch.c       |  2 ++\n t/t5551-http-fetch.sh | 16 ++++++++++++++++\n 2 files changed, 18 insertions(+)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 5647055..2496ad2 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -750,6 +750,8 @@ static struct transport *prepare_transport(struct remote *remote)\n \n static void backfill_tags(struct transport *transport, struct ref *ref_map)\n {\n+\tif (getenv(\"GIT_TEST_BACKFILL_TAGS\"))\n+\t\tfprintf(stderr, \"backfill_tags executed\\n\");\n \tif (transport->cannot_reuse) {\n \t\tgsecondary = prepare_transport(transport->remote);\n \t\ttransport = gsecondary;\ndiff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh\nindex 1b71bb5..7eeb043 100755\n--- a/t/t5551-http-fetch.sh\n+++ b/t/t5551-http-fetch.sh\n@@ -181,6 +181,22 @@ test_expect_success 'create namespaced refs' '\n \t\tsymbolic-ref refs/namespaces/ns/HEAD refs/namespaces/ns/refs/heads/master\n '\n \n+test_expect_success 'trigger backfill_tags() over smart-http' '\n+\tgit tag -m two tag-two &&\n+\techo content >>file &&\n+\tgit commit -a -m three &&\n+\tgit push public master tag-two &&\n+\tgit rev-parse master tag-two >expected &&\n+\t(\n+\tgit init shallow &&\n+\tcd shallow &&\n+\tGIT_TEST_BACKFILL_TAGS=1 git fetch --depth=2 $HTTPD_URL/smart/repo.git master:foo 2>err &&\n+\tgrep \"backfill_tags executed\" err &&\n+\tgit rev-parse foo tag-two >../actual\n+\t) &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'smart clone respects namespace' '\n \tgit clone \"$HTTPD_URL/smart_namespace/repo.git\" ns-smart &&\n \techo namespaced >expect &&\n-- \n1.8.5.1.25.g8667982\n"}]}