mirror of
https://github.com/git/git.git
synced 2024-11-01 14:57:52 +01:00
e6641d2fa6
t5410 creates a sample script "alternate-refs", and sets core.alternateRefsCommand to just "alternate-refs". That shouldn't work, as "." is not in our $PATH, and so we should not find it. However, due to a bug in run-command.c, we sometimes find it anyway! Even more confusing, this bug is only in the fork-based version of run-command. So the test passes on Linux (etc), but fails on Windows. In preparation for fixing the run-command bug, let's use a more complete path here. Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
41 lines
1.1 KiB
Bash
Executable file
41 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='git receive-pack with alternate ref filtering'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'setup' '
|
|
test_commit base &&
|
|
git clone -s --bare . fork &&
|
|
git checkout -b public/branch master &&
|
|
test_commit public &&
|
|
git checkout -b private/branch master &&
|
|
test_commit private
|
|
'
|
|
|
|
extract_haves () {
|
|
depacketize | perl -lne '/^(\S+) \.have/ and print $1'
|
|
}
|
|
|
|
test_expect_success 'with core.alternateRefsCommand' '
|
|
write_script fork/alternate-refs <<-\EOF &&
|
|
git --git-dir="$1" for-each-ref \
|
|
--format="%(objectname)" \
|
|
refs/heads/public/
|
|
EOF
|
|
test_config -C fork core.alternateRefsCommand ./alternate-refs &&
|
|
git rev-parse public/branch >expect &&
|
|
printf "0000" | git receive-pack fork >actual &&
|
|
extract_haves <actual >actual.haves &&
|
|
test_cmp expect actual.haves
|
|
'
|
|
|
|
test_expect_success 'with core.alternateRefsPrefixes' '
|
|
test_config -C fork core.alternateRefsPrefixes "refs/heads/private" &&
|
|
git rev-parse private/branch >expect &&
|
|
printf "0000" | git receive-pack fork >actual &&
|
|
extract_haves <actual >actual.haves &&
|
|
test_cmp expect actual.haves
|
|
'
|
|
|
|
test_done
|