Re: t9902 fails
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 18, 2013, 16:49 UTC
- Message-ID
- <7v8v7qsagd.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20130118000454.GI13449@google.com>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 7 quoted lines
> Here's a patch to make the tested command a little less likely to > conflict with commands from the user's $PATH. I'm not thrilled with > it because the contents of $PATH are still not tightly controlled, and > this does nothing to avoid problems due to existence of, for example, > a "git cherry-pick-branches" command. > > Thoughts?
How about doing something like this and set that variable in the test instead? If STD_ONLY is not set, you will get everything, but when STD_ONLY is set, we will stop reading from "help -a" when it starts listing additional stuff.
contrib/completion/git-completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index a4c48e1..415a078 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -534,7 +534,8 @@ __git_complete_strategy () __git_list_all_commands () { local i IFS=" "$'\n' - for i in $(git help -a|egrep '^ [a-zA-Z0-9]') + for i in $(LANG=C LC_ALL=C git help -a | + sed -n ${GIT_HELP_STD_ONLY+-e /^git.*elsewhere/q} -e '/^ [a-zA-Z0-9]/p') do case $i in *--*) : helper pattern;;