1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 08:47:56 +01:00
git/t/t5802-connect-helper.sh
Junio C Hamano b9ccf55e06 t5802: add test for connect helper
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 <gitster@pobox.com>
2013-08-07 16:24:30 -07:00

72 lines
1.6 KiB
Bash
Executable file

#!/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