[PATCH V5 0/3] refactor t1517 to focus on help output outside a repository
- From
Usman Akinyemi <usmanakinyemi202@gmail.com>
- Date
- Aug 3, 2025, 02:07 UTC
- Message-ID
- <20250803020744.1037392-1-usmanakinyemi202@gmail.com>
- In-Reply-To
- <20250721115519.140361-1-usmanakinyemi202@gmail.com>
This series refactors t1517-outside-repo.sh to focus on testing `git subcmd -h` outside a Git repository. It does two things:
1. Moves the existing `update-server-info -h` test to t5200, since it
tests behavior *inside* a repo and belongs with other update-server-info
tests.
2. Introduces a loop in t1517 that automatically verifies `-h` output
for all main Git subcommands when run outside a repository, using
the `nongit` helper and `git --list-cmds=main`.This makes t1517 easier to maintain and ensures that new commands are automatically covered for this class of behavior.
Changes since v4: - Changes the approach from having the t1517 to test both help outside and inside repo to just having inside repo. - Drop spurious message during test - Fix known breakages that actually work - Fix new t5200 by removing the trailing && - Move the `prune -h` test to t5304
Usman Akinyemi (3): t/t1517: automate `git subcmd -h` tests outside a repository t5200: move `update-server-info -h` test from t1517 t5304: move `prune -h` test from t1517
t/t1517-outside-repo.sh | 34 +++++++++++++++++++++------------- t/t5200-update-server-info.sh | 5 +++++ t/t5304-prune.sh | 5 +++++ 3 files changed, 31 insertions(+), 13 deletions(-)
Range-diff against v2:
1: 11eb3e7bfe < -: ---------- t/t1517: automate `git subcmd -h` tests outside a repository
-: ---------- > 1: 75a1d540e4 t/t1517: automate `git subcmd -h` tests outside a repository
2: 5cf43192d0 ! 2: 8c028256a0 t5200: move `update-server-info -h` test from t1517
@@ t/t1517-outside-repo.sh: test_expect_success LIBCURL 'remote-http outside reposi
-test_expect_success 'update-server-info does not crash with -h' '
- test_expect_code 129 git update-server-info -h >usage &&
-- test_grep "[Uu]sage: git update-server-info " usage &&
+- test_grep "[Uu]sage: git update-server-info " usage
-'
-
+ test_expect_success 'prune does not crash with -h' '
+ test_expect_code 129 git prune -h >usage &&
+ test_grep "[Uu]sage: git prune " usage &&
+ test_expect_code 129 nongit git prune -h >usage &&
+ test_grep "[Uu]sage: git prune " usage
+ '
++
for cmd in $(git --list-cmds=main)
do
cmd=${cmd%.*} # strip .sh, .perl, etc.
@@ t/t5200-update-server-info.sh: test_expect_success 'midx does not create duplica
+test_expect_success 'update-server-info does not crash with -h' '
+ test_expect_code 129 git update-server-info -h >usage &&
-+ test_grep "[Uu]sage: git update-server-info " usage &&
++ test_grep "[Uu]sage: git update-server-info " usage
+'
+
test_done
-: ---------- > 3: c1cdbf272f t5304: move `prune -h` test from t1517-- 2.50.1