Re: [PATCH v1 3/3] git: catch an attempt to run "git-foo"
From: Junio C Hamano <hidden>
Date: 2020-08-26 01:19:27
Junio C Hamano [off-list ref] writes:
If we were to propose removing "git-foo" binaries from the filesystem for built-in commands, we should first see if there are users who will be affected by such a move. When cmd_main() detects we were called not as "git", but as "git-foo", give an error message to ask the user to let us know and stop our removal plan, unless we are running a selected few programs that MUST be callable in the dashed form (e.g. "git-upload-pack"). Those who are always using "git foo" form will not be affected, but those who trusted the promise we made to them 12 years ago that by prepending the output of $(git --exec-path) to the list of directories on their $PATH, they can safely keep writing "git-cat-file" will be negatively affected as all their scripts assuming the promise will be kept are now broken. Signed-off-by: Junio C Hamano <redacted> ---
The same idea as the one for pack-redundant. I do not use the technique to inspect $PATH and see if $GIT_EXEC_PATH is on it, as that would mean we will *not* bug users with legitimate need to keep the feature working, hence will not get "don't do that" objections. We may want to ensure command_list[] is sorted by name and run binary search on it if running find_cmdname_help() for each and every dashed "git-foo" invocations turns out to be costly. Our conjecture behind this patch is that the form is rarely if ever used, so it may not matter at all, though.