Merge branch 'js/spell-out-options-in-tests'
authorJunio C Hamano <gitster@pobox.com>
Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)
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

1  2 
t/README
t/t5516-fetch-push.sh
diff --combined t/README
index e3652ff50b6df0209c94de82dd551460e5831172,9ed3051a1cc662208cd84afbd4817f1abbc7f5f5..af1243eb49efab5e5763c54e82697bf277be0adf
+++ b/t/README
@@@ -343,9 -343,6 +343,9 @@@ marked strings" in po/README for detail
  GIT_TEST_SPLIT_INDEX=<boolean> forces split-index mode on the whole
  test suite. Accept any boolean values that are accepted by git-config.
  
 +GIT_TEST_PROTOCOL_VERSION=<n>, when set, overrides the
 +'protocol.version' setting to n if it is less than n.
 +
  GIT_TEST_FULL_IN_PACK_ARRAY=<boolean> 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=<boolean> exercises the preload-index code path
  by overriding the minimum number of cache entries required per thread.
  
 -GIT_TEST_REBASE_USE_BUILTIN=<boolean>, when false, disables the
 -builtin version of git-rebase. See 'rebase.useBuiltin' in
 +GIT_TEST_STASH_USE_BUILTIN=<boolean>, when false, disables the
 +built-in version of git-stash. See 'stash.useBuiltin' in
  git-config(1).
  
  GIT_TEST_INDEX_THREADS=<n> enables exercising the multi-threaded loading
@@@ -402,6 -399,10 +402,10 @@@ GIT_TEST_SIDEBAND_ALL=<boolean>, when t
  fetch-pack to not request sideband-all (even if the server advertises
  sideband-all).
  
+ GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=<boolean>, 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 4bfbb7965476991e41c042b47e74ef9c6187efcc,db0b1db45809654abc3a73e0bed0a94d65609937..49bf4280e85cae7da71b54192ab83879931283bd
@@@ -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 &&
  
                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
                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 &&
                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 &&