Re: [PATCH v4 1/2] t/t1517: automate `git subcmd -h` tests outside a repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 26, 2025 at 10:34 AM D. Ben Knoble <ben.knoble@xxxxxxxxx> wrote:
>
> On Mon, Jul 21, 2025 at 7:55 AM 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>
> > Signed-off-by: Usman Akinyemi <usmanakinyemi202@xxxxxxxxx>
> > ---
> >  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 | \
>
> Hm—if we strip the suffix with ${cmd%.*}, do we need a p4.py pattern
> too? Actually, at first I wondered why we need to strip the suffix at
> all. My local Git produces only unsuffixed commands. But
> bin-wrappers/git produces both p4 and p4.py; request-pull and
> request-pull.sh; and several others. So I think stripping is probably
> right, just drop the .py pattern.

I think that using "instaweb.sh" instead of "instaweb" also causes
this to fail on Windows, like:

https://github.com/benknoble/git/actions/runs/16695826272/job/47259908953

-- 
D. Ben Knoble





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux