This is an attempt to reproduce a problem reported for a third-party
custom "connect" remote helper.  The conjecture is that sometimes
"git fetch" wants to make two connections (one for the primary
transfer with 'follow-tags' option set, and then after noticing that
some tags are not packed because the primary transfer did not have
to send any commit that is pointed by them, another to explicitly
ask for the missing tags), and their "connect" helper is not called
in the second request, breaking the "fetch" as a whole.

Unfortunately this test script does not trigger the alleged failure
and happily passes when talking to upload-pack from git-core (see
patch 5/5 for details).

Signed-off-by: Junio C Hamano <gits...@pobox.com>
---
 t/t5802-connect-helper.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100755 t/t5802-connect-helper.sh

diff --git a/t/t5802-connect-helper.sh b/t/t5802-connect-helper.sh
new file mode 100755
index 0000000..878faf2
--- /dev/null
+++ b/t/t5802-connect-helper.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+test_description='ext::cmd remote "connect" helper'
+. ./test-lib.sh
+
+test_expect_success setup '
+       test_tick &&
+       git commit --allow-empty -m initial &&
+       test_tick &&
+       git commit --allow-empty -m second &&
+       test_tick &&
+       git commit --allow-empty -m third &&
+       test_tick &&
+       git tag -a -m "tip three" three &&
+
+       test_tick &&
+       git commit --allow-empty -m fourth
+'
+
+test_expect_success clone '
+       cmd=$(echo "echo >&2 ext::sh invoked && %S .." | sed -e "s/ /% /g") &&
+       git clone "ext::sh -c %S% ." dst &&
+       git for-each-ref refs/heads/ refs/tags/ >expect &&
+       (
+               cd dst &&
+               git config remote.origin.url "ext::sh -c $cmd" &&
+               git for-each-ref refs/heads/ refs/tags/
+       ) >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'update following tag' '
+       test_tick &&
+       git commit --allow-empty -m fifth &&
+       test_tick &&
+       git tag -a -m "tip five" five &&
+       git for-each-ref refs/heads/ refs/tags/ >expect &&
+       (
+               cd dst &&
+               git pull &&
+               git for-each-ref refs/heads/ refs/tags/ >../actual
+       ) &&
+       test_cmp expect actual
+'
+
+test_expect_success 'update backfilled tag' '
+       test_tick &&
+       git commit --allow-empty -m sixth &&
+       test_tick &&
+       git tag -a -m "tip two" two three^1 &&
+       git for-each-ref refs/heads/ refs/tags/ >expect &&
+       (
+               cd dst &&
+               git pull &&
+               git for-each-ref refs/heads/ refs/tags/ >../actual
+       ) &&
+       test_cmp expect actual
+'
+
+test_expect_success 'update backfilled tag without primary transfer' '
+       test_tick &&
+       git tag -a -m "tip one " one two^1 &&
+       git for-each-ref refs/heads/ refs/tags/ >expect &&
+       (
+               cd dst &&
+               git pull &&
+               git for-each-ref refs/heads/ refs/tags/ >../actual
+       ) &&
+       test_cmp expect actual
+'
+
+test_done
-- 
1.8.4-rc1-210-gf6d87e2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to