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

From: Junio C Hamano <[email-masked]>
Date: Mon, 28 Jul 2025 08:08:48 -0700

"D. Ben Knoble" <[email-masked]> writes:

>> +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.
> ...
> 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.

Ahh, OK, I didn't realize that bin-wrappers gets into the picture.
So you're right.  Fixing the bin-wrappers may be necessary, but
dropping the extra ones is certainly a good idea.

>> +       test_$expect_outcome "'git $cmd -h' outside a repository" '
>> +               test_expect_code 129 nongit git $cmd -h >usage &&
>> +               echo "Hello" &&
>
> Woops! While basing some work on this branch, I spotted this "echo"—I
> assume it's leftover and didn't mean to be included here?

;-)