Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Jul 26, 2025, 14:52 UTC
- Message-ID
- <CALnO6CCxTQYnVmdjeDnCyr=9i9S-uP9QbF9X0dUTfeJ4mcX4ig@mail.gmail.com>
- In-Reply-To
- <CALnO6CCFXfPDZKzx1SBufwzkBJchZr0XYigo_8AQ_U=MuJa7xg@mail.gmail.com>
On Sat, Jul 26, 2025 at 10:37 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
Show 47 quoted lines
>
> On Mon, Jul 21, 2025 at 7:55 AM Usman Akinyemi
> <usmanakinyemi202@gmail.com> 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@pks.im>
> > Helped-by: Junio C Hamano <gitster@pobox.com>
> > Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
> > ---
> > t/t1517-outside-repo.sh | 25 +++++++++++++++++++++++--
> > 1 file changed, 23 insertions(+), 2 deletions(-)
> >
> > diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
> > index 6824581317..9fcebb7d94 100755
> > --- a/t/t1517-outside-repo.sh
> > +++ b/t/t1517-outside-repo.sh
> > @@ -110,8 +110,29 @@ 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
> > '
> >
> > +for cmd in $(git --list-cmds=main)
> > +do
> > + 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 | instaweb.sh | \
> > + merge-octopus | merge-one-file | merge-resolve | mergetool | \
> > + mktag | p4 | p4.py | pickaxe | quiltimport | remote-ftp | remote-ftps | \
> > + remote-http | remote-https | replay | request-pull | send-email | \
> > + sh-i18n--envsubst | shell | show | stage | submodule | svn | \
> > + upload-archive--writer | upload-pack | web--browse | whatchanged)
>
> Sorry, one more thing: I spot-checked a few of these, and it seems the
> main issue that causes failures is the exit code; they seem to work
> with "-h" outside a repo. Out of scope for this series, but something
> worth tidying up as #leftoverbits ?It turns out a few pass for me right now: quiltimport and request-pull both work just fine.
-- D. Ben Knoble