From: Junio C Hamano Date: Mon, 22 Apr 2019 02:14:47 +0000 (+0900) Subject: Merge branch 'js/spell-out-options-in-tests' X-Git-Tag: v2.22.0-rc0~79 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/39e4773daa758243ff3c708b024f39b7e47f0d7e?hp=-c Merge branch 'js/spell-out-options-in-tests' The tests have been updated not to rely on the abbreviated option names the parse-options API offers, to protect us from an abbreviated form of an option that used to be unique within the command getting non-unique when a new option that share the same prefix is added. * js/spell-out-options-in-tests: tests: disallow the use of abbreviated options (by default) tests (pack-objects): use the full, unabbreviated `--revs` option tests (status): spell out the `--find-renames` option in full tests (push): do not abbreviate the `--follow-tags` option t5531: avoid using an abbreviated option t7810: do not abbreviate `--no-exclude-standard` nor `--invert-match` tests (rebase): spell out the `--force-rebase` option tests (rebase): spell out the `--keep-empty` option --- 39e4773daa758243ff3c708b024f39b7e47f0d7e diff --combined t/README index e3652ff50b,9ed3051a1c..af1243eb49 --- a/t/README +++ b/t/README @@@ -343,9 -343,6 +343,9 @@@ marked strings" in po/README for detail GIT_TEST_SPLIT_INDEX= forces split-index mode on the whole test suite. Accept any boolean values that are accepted by git-config. +GIT_TEST_PROTOCOL_VERSION=, when set, overrides the +'protocol.version' setting to n if it is less than n. + GIT_TEST_FULL_IN_PACK_ARRAY= exercises the uncommon pack-objects code path where there are more than 1024 packs even if the actual number of packs in repository is below this limit. Accept @@@ -384,8 -381,8 +384,8 @@@ the --no-sparse command-line argument GIT_TEST_PRELOAD_INDEX= exercises the preload-index code path by overriding the minimum number of cache entries required per thread. -GIT_TEST_REBASE_USE_BUILTIN=, when false, disables the -builtin version of git-rebase. See 'rebase.useBuiltin' in +GIT_TEST_STASH_USE_BUILTIN=, when false, disables the +built-in version of git-stash. See 'stash.useBuiltin' in git-config(1). GIT_TEST_INDEX_THREADS= enables exercising the multi-threaded loading @@@ -402,6 -399,10 +402,10 @@@ GIT_TEST_SIDEBAND_ALL=, when t fetch-pack to not request sideband-all (even if the server advertises sideband-all). + GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=, when true (which is + the default when running tests), errors out when an abbreviated option + is used. + Naming Tests ------------ diff --combined t/t5516-fetch-push.sh index 4bfbb79654,db0b1db458..49bf4280e8 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@@ -1147,12 -1147,8 +1147,12 @@@ test_expect_success 'fetch exact SHA1' git prune && test_must_fail git cat-file -t $the_commit && + # Some protocol versions (e.g. 2) support fetching + # unadvertised objects, so restrict this test to v0. + # fetching the hidden object should fail by default - test_must_fail git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err && + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ + git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err && test_i18ngrep "Server does not allow request for unadvertised object" err && test_must_fail git rev-parse --verify refs/heads/copy && @@@ -1208,10 -1204,7 +1208,10 @@@ d mk_empty shallow && ( cd shallow && - test_must_fail git fetch --depth=1 ../testrepo/.git $SHA1 && + # Some protocol versions (e.g. 2) support fetching + # unadvertised objects, so restrict this test to v0. + test_must_fail env GIT_TEST_PROTOCOL_VERSION= \ + git fetch --depth=1 ../testrepo/.git $SHA1 && git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true && git fetch --depth=1 ../testrepo/.git $SHA1 && git cat-file commit $SHA1 @@@ -1239,20 -1232,15 +1239,20 @@@ mk_empty shallow && ( cd shallow && - test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_3 && - test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_1 && + # Some protocol versions (e.g. 2) support fetching + # unadvertised objects, so restrict this test to v0. + test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \ + git fetch ../testrepo/.git $SHA1_3 && + test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \ + git fetch ../testrepo/.git $SHA1_1 && git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true && git fetch ../testrepo/.git $SHA1_1 && git cat-file commit $SHA1_1 && test_must_fail git cat-file commit $SHA1_2 && git fetch ../testrepo/.git $SHA1_2 && git cat-file commit $SHA1_2 && - test_must_fail ok=sigpipe git fetch ../testrepo/.git $SHA1_3 + test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \ + git fetch ../testrepo/.git $SHA1_3 ) ' done @@@ -1382,7 -1370,7 +1382,7 @@@ test_expect_success 'push does not foll test_cmp expect actual ' - test_expect_success 'push --follow-tag only pushes relevant tags' ' + test_expect_success 'push --follow-tags only pushes relevant tags' ' mk_test testrepo heads/master && rm -fr src dst && git init src && @@@ -1396,7 -1384,7 +1396,7 @@@ git tag -m "future" future && git checkout master && git for-each-ref refs/heads/master refs/tags/tag >../expect && - git push --follow-tag ../dst master + git push --follow-tags ../dst master ) && ( cd dst &&