fetch tests: add scaffolding for the new fetch.pruneTags

The fetch.pruneTags configuration doesn't exist yet, but will be added
in a subsequent commit. Since testing for it requires adding new
parameters to the test_configured_prune function it's easier to review
this patch first to assert that no functional changes are introduced
yet.

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:14 +00:00 committed by Junio C Hamano
parent 627a129b46
commit e249ce0ccd

View File

@ -562,10 +562,12 @@ test_configured_prune () {
test_configured_prune_type () {
fetch_prune=$1
remote_origin_prune=$2
expected_branch=$3
expected_tag=$4
cmdline=$5
mode=$6
fetch_prune_tags=$3
remote_origin_prune_tags=$4
expected_branch=$5
expected_tag=$6
cmdline=$7
mode=$8
if test -z "$cmdline_setup"
then
@ -590,14 +592,16 @@ test_configured_prune_type () {
cmdline="$new_cmdline"
fi
test_expect_success "$mode prune fetch.prune=$1 remote.origin.prune=$2${5:+ $5}; branch:$3 tag:$4" '
test_expect_success "$mode prune fetch.prune=$1 remote.origin.prune=$2 fetch.pruneTags=$3 remote.origin.pruneTags=$4${7:+ $7}; branch:$5 tag:$6" '
# make sure a newbranch is there in . and also in one
git branch -f newbranch &&
git tag -f newtag &&
(
cd one &&
test_unconfig fetch.prune &&
test_unconfig fetch.pruneTags &&
test_unconfig remote.origin.prune &&
test_unconfig remote.origin.pruneTags &&
git fetch '"$cmdline_setup"' &&
git rev-parse --verify refs/remotes/origin/newbranch &&
git rev-parse --verify refs/tags/newtag
@ -612,7 +616,9 @@ test_configured_prune_type () {
cd one &&
git_fetch_c="" &&
set_config_tristate fetch.prune $fetch_prune &&
set_config_tristate fetch.pruneTags $fetch_prune_tags &&
set_config_tristate remote.origin.prune $remote_origin_prune &&
set_config_tristate remote.origin.pruneTags $remote_origin_prune_tags &&
if test "$mode" != "link"
then
@ -641,57 +647,59 @@ test_configured_prune_type () {
# $1 config: fetch.prune
# $2 config: remote.<name>.prune
# $3 expect: branch to be pruned?
# $4 expect: tag to be pruned?
# $5 git-fetch $cmdline:
# $3 config: fetch.pruneTags
# $4 config: remote.<name>.pruneTags
# $5 expect: branch to be pruned?
# $6 expect: tag to be pruned?
# $7 git-fetch $cmdline:
#
# $1 $2 $3 $4 $5
test_configured_prune unset unset kept kept ""
test_configured_prune unset unset kept kept "--no-prune"
test_configured_prune unset unset pruned kept "--prune"
test_configured_prune unset unset kept pruned \
# $1 $2 $3 $4 $5 $6 $7
test_configured_prune unset unset unset unset kept kept ""
test_configured_prune unset unset unset unset kept kept "--no-prune"
test_configured_prune unset unset unset unset pruned kept "--prune"
test_configured_prune unset unset unset unset kept pruned \
"--prune origin refs/tags/*:refs/tags/*"
test_configured_prune unset unset pruned pruned \
test_configured_prune unset unset unset unset pruned pruned \
"--prune origin refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*"
test_configured_prune false unset kept kept ""
test_configured_prune false unset kept kept "--no-prune"
test_configured_prune false unset pruned kept "--prune"
test_configured_prune false unset unset unset kept kept ""
test_configured_prune false unset unset unset kept kept "--no-prune"
test_configured_prune false unset unset unset pruned kept "--prune"
test_configured_prune true unset pruned kept ""
test_configured_prune true unset pruned kept "--prune"
test_configured_prune true unset kept kept "--no-prune"
test_configured_prune true unset unset unset pruned kept ""
test_configured_prune true unset unset unset pruned kept "--prune"
test_configured_prune true unset unset unset kept kept "--no-prune"
test_configured_prune unset false kept kept ""
test_configured_prune unset false kept kept "--no-prune"
test_configured_prune unset false pruned kept "--prune"
test_configured_prune unset false unset unset kept kept ""
test_configured_prune unset false unset unset kept kept "--no-prune"
test_configured_prune unset false unset unset pruned kept "--prune"
test_configured_prune false false kept kept ""
test_configured_prune false false kept kept "--no-prune"
test_configured_prune false false pruned kept "--prune"
test_configured_prune false false kept pruned \
test_configured_prune false false unset unset kept kept ""
test_configured_prune false false unset unset kept kept "--no-prune"
test_configured_prune false false unset unset pruned kept "--prune"
test_configured_prune false false unset unset kept pruned \
"--prune origin refs/tags/*:refs/tags/*"
test_configured_prune false false pruned pruned \
test_configured_prune false false unset unset pruned pruned \
"--prune origin refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*"
test_configured_prune true false kept kept ""
test_configured_prune true false pruned kept "--prune"
test_configured_prune true false kept kept "--no-prune"
test_configured_prune true false unset unset kept kept ""
test_configured_prune true false unset unset pruned kept "--prune"
test_configured_prune true false unset unset kept kept "--no-prune"
test_configured_prune unset true pruned kept ""
test_configured_prune unset true kept kept "--no-prune"
test_configured_prune unset true pruned kept "--prune"
test_configured_prune unset true unset unset pruned kept ""
test_configured_prune unset true unset unset kept kept "--no-prune"
test_configured_prune unset true unset unset pruned kept "--prune"
test_configured_prune false true pruned kept ""
test_configured_prune false true kept kept "--no-prune"
test_configured_prune false true pruned kept "--prune"
test_configured_prune false true unset unset pruned kept ""
test_configured_prune false true unset unset kept kept "--no-prune"
test_configured_prune false true unset unset pruned kept "--prune"
test_configured_prune true true pruned kept ""
test_configured_prune true true pruned kept "--prune"
test_configured_prune true true kept kept "--no-prune"
test_configured_prune true true kept pruned \
test_configured_prune true true unset unset pruned kept ""
test_configured_prune true true unset unset pruned kept "--prune"
test_configured_prune true true unset unset kept kept "--no-prune"
test_configured_prune true true unset unset kept pruned \
"--prune origin refs/tags/*:refs/tags/*"
test_configured_prune true true pruned pruned \
test_configured_prune true true unset unset pruned pruned \
"--prune origin refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*"
test_expect_success 'all boundary commits are excluded' '