On Sat, Aug 2, 2025 at 10:07 PM Usman Akinyemi <usmanakinyemi202@xxxxxxxxx> wrote: > > Replace manual `-h` tests with a loop over all subcommands using > `git --list-cmds=main`. This ensures consistent coverage of `-h` > behavior outside a repo and future-proofs the test by covering > new commands automatically. > > Known exceptions are skipped or marked as expected failures. > > Suggested-by: Patrick Steinhardt <ps@xxxxxx> > Helped-by: Junio C Hamano <gitster@xxxxxxxxx> > Helped-by: D. Ben Knoble <ben.knoble+github@xxxxxxxxx> > Signed-off-by: Usman Akinyemi <usmanakinyemi202@xxxxxxxxx> > --- > t/t1517-outside-repo.sh | 23 +++++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > > diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh > index 8f59b867f2..4a827b96f0 100755 > --- a/t/t1517-outside-repo.sh > +++ b/t/t1517-outside-repo.sh > @@ -109,8 +109,6 @@ test_expect_success LIBCURL 'remote-http outside repository' ' > > 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_expect_code 129 nongit git update-server-info -h >usage && > test_grep "[Uu]sage: git update-server-info " usage > ' > > @@ -120,5 +118,26 @@ test_expect_success 'prune does not crash with -h' ' > test_expect_code 129 nongit git prune -h >usage && > test_grep "[Uu]sage: git prune " usage > ' > +for cmd in $(git --list-cmds=main) > +do This part of the patch does not apply cleanly to v2.50.0 (the original base of the series), but I was able to apply to latest master (866e6a391f (The sixteenth batch, 2025-08-01)). It seems like the conflict was due to 7cd03a555a (builtin/prune: stop depending on 'the_repository', 2025-07-04). All fine, just leaving a note for myself ;) I didn't see any mention of the changed base in the cover letter, so I was confused. (Rebasing onto latest master makes sense to me, but I'm not sure what the list convention is). PS I think we want a newline after the closing quote of the prune test and before the start of the loop. > + cmd=${cmd%.*} # strip .sh, .perl, etc. > + case "$cmd" in > + archimport | cvsexportcommit | cvsimport | cvsserver | daemon | \ > + difftool--helper | filter-branch | fsck-objects | get-tar-commit-id | \ > + http-backend | http-fetch | http-push | init-db | \ > + merge-octopus | merge-one-file | merge-resolve | mergetool | \ > + mktag | p4 | p4.py | pickaxe | remote-ftp | remote-ftps | \ > + remote-http | remote-https | replay | send-email | \ > + sh-i18n--envsubst | shell | show | stage | submodule | svn | \ > + upload-archive--writer | upload-pack | web--browse | whatchanged) > + expect_outcome=expect_failure ;; > + *) > + expect_outcome=expect_success ;; > + esac > + test_$expect_outcome "'git $cmd -h' outside a repository" ' > + test_expect_code 129 nongit git $cmd -h >usage && > + test_grep "[Uu]sage: git $cmd " usage > + ' > +done > > test_done > -- > 2.50.1 > I have had to deal with yet more instaweb issues [1], which I think are because the Windows CI runs without Perl. I'm trying to come up with a fix there, but any advice welcome. (I think we just need to mark that test with the Perl pre-req, but it's interesting that this is the only command I've seen have that problem.) Looks like Makefile:2664 is the responsible code, which I couldn't find from just looking at the instaweb script (instead had to grep the error message -> grep for use of the "unimplemented" script). [1]: https://github.com/benknoble/git/actions/runs/16699688470/job/47268852351 -- D. Ben Knoble