If I run the git-cp script directly with no parameters, the output says USAGE: /foo/bar/bin/git-cp [...] which is on point. I might want it to just say git-cp there, but that's a minor quibble.
More importantly, and the subject of this issue, is that if I run git cp and git searches my path to find the git-cp script, then the output STILL says USAGE: /foo/bar/bin/git-cp [...] when I think it should say USAGE: git cp [...] in keeping with the behavior of most other git commands.
Some git command scripts included with git use different approaches for this:
git-archimport, git-cvsexportcommit, git-cvsimport, git-cvsserver, and git-merge-one-file all hard code the usage text of git whatever without regard for the actual filename
git-filter-branch, git-merge-one-file, git-mergetool, git-submodule, and git-web--browse all use git-sh-setup's usage() to parse the script filename and blindly removes the first dash
git-p4 does what git-extras does now, outputting the full path to the script
I propose one of the following solutions:
- Hard code
git foo as the usage invocation for git-foo across all the scripts
- Use
git-sh-setup's usage()
- Implement a custom detection of git invocation, perhaps by checking for
GIT_EXEC_PATH
I volunteer to implement any of these if you pick one.
If I run the
git-cpscript directly with no parameters, the output saysUSAGE: /foo/bar/bin/git-cp [...]which is on point. I might want it to just saygit-cpthere, but that's a minor quibble.More importantly, and the subject of this issue, is that if I run
git cpand git searches my path to find thegit-cpscript, then the output STILL saysUSAGE: /foo/bar/bin/git-cp [...]when I think it should sayUSAGE: git cp [...]in keeping with the behavior of most other git commands.Some git command scripts included with git use different approaches for this:
git-archimport,git-cvsexportcommit,git-cvsimport,git-cvsserver, andgit-merge-one-fileall hard code the usage text ofgit whateverwithout regard for the actual filenamegit-filter-branch,git-merge-one-file,git-mergetool,git-submodule, andgit-web--browseall usegit-sh-setup'susage()to parse the script filename and blindly removes the first dashgit-p4does whatgit-extrasdoes now, outputting the full path to the scriptI propose one of the following solutions:
git fooas the usage invocation forgit-fooacross all the scriptsgit-sh-setup'susage()GIT_EXEC_PATHI volunteer to implement any of these if you pick one.