Subject: [PATCH v2 0/2] test-lib-functions: fix test_subcommand_inexact

From: "Derrick Stolee via GitGitGadget" <[email-masked]>
Date: Thu, 24 Mar 2022 18:34:55 +0000

Junio discovered in [1] that test_subcommand_inexact is more flexible than
initially intended.

[1] https://lore.kernel.org/git/[email-masked]/

The intention was that we do not need to specify the remaining arguments for
a subcommand, but instead the current behavior is to allow the given
arguments to appear as any subsequence within the command (except that the
first "git" instance must be the first argument).

This changes the helper to be more rigid.

Changes in v2
=============

 * After noticing that t7700 fails with the helper change, Taylor wrote a
   modification of the test to check the post-conditions directly and avoid
   the helper. This is included as Patch 1 with some modifications to be
   easier to read.

 * Patch 2 is the v1 patch with some change to the commit message about why
   the tests pass after patch 1.

Thanks, -Stolee

Derrick Stolee (2):
  t7700: check post-condition in kept-pack test
  test-lib-functions: fix test_subcommand_inexact

 t/t7700-repack.sh       | 52 ++++++++++++++++++++++++++++++++++++++---
 t/test-lib-functions.sh |  4 ++--
 2 files changed, 51 insertions(+), 5 deletions(-)

base-commit: a68dfadae5e95c7f255cf38c9efdcbc2e36d1931
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1185%2Fderrickstolee%2Ftest-subcommand-fix-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1185/derrickstolee/test-subcommand-fix-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1185

Range-diff vs v1:

 -:  ----------- > 1:  f2f8d12929b t7700: check post-condition in kept-pack test
 1:  50176722bbf ! 2:  ed67b748971 test-lib-functions: fix test_subcommand_inexact
     @@ Commit message
          the printf statement, then adding ".*" after stripping out the trailing
          comma.
      
     -    All existing tests continue to pass with this change, since none of them
     -    were taking advantage of this unintended flexibility.
     +    All existing tests continue to pass with this change. There was one
     +    instance from t7700-repack.sh that was taking advantage of this
     +    flexibility, but it was removed in the previous change.
      
     +    Helped-by: Taylor Blau <[email-masked]>
          Signed-off-by: Derrick Stolee <[email-masked]>
      
       ## t/test-lib-functions.sh ##

-- 
gitgitgadget