fetch tests: refactor in preparation for testing tag pruning

In a subsequent commit this function will learn to test for tag
pruning, prepare for that by making space for more variables, and
making it clear that "expected" here refers to branches.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2018-02-09 20:32:04 +00:00 committed by Junio C Hamano
parent 750d0da9cf
commit eca142d308

View File

@ -549,9 +549,12 @@ set_config_tristate () {
} }
test_configured_prune () { test_configured_prune () {
fetch_prune=$1 remote_origin_prune=$2 cmdline=$3 expected=$4 fetch_prune=$1
remote_origin_prune=$2
cmdline=$3
expected_branch=$4
test_expect_success "prune fetch.prune=$1 remote.origin.prune=$2${3:+ $3}; $4" ' test_expect_success "prune fetch.prune=$1 remote.origin.prune=$2${3:+ $3}; branch:$4" '
# make sure a newbranch is there in . and also in one # make sure a newbranch is there in . and also in one
git branch -f newbranch && git branch -f newbranch &&
( (
@ -572,7 +575,7 @@ test_configured_prune () {
set_config_tristate remote.origin.prune $remote_origin_prune && set_config_tristate remote.origin.prune $remote_origin_prune &&
git fetch $cmdline && git fetch $cmdline &&
case "$expected" in case "$expected_branch" in
pruned) pruned)
test_must_fail git rev-parse --verify refs/remotes/origin/newbranch test_must_fail git rev-parse --verify refs/remotes/origin/newbranch
;; ;;