git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] If `egrep` is aliased, temporary disable it in bash.completion

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 29, 2012, 17:03 UTC
Message-ID
<7vpq2wqr3v.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20121129151418.GA19169@redhat.com>
Adam Tkac <atkac@redhat.com> writes:
> Subject: Re: [PATCH v2] If `egrep` is aliased, temporary disable it in bash.completion

The code does not seem to do anything special if it is not aliased, though, so "If ..." part does not sound correct; perhaps you meant "just in case egrep is aliased to something totally wacky" or something?

The script seems to use commands other than 'egrep' that too can be aliased to do whatever unexpected things. How does this patch get away without backslashing them all, like

	\echo ...
        \sed ...
        \test ...
        \: comment ...
	\git args ...

and still fix problems for users? Can't the same solution you would give to users who alias one of the above to do something undesirable be applied to those who alias egrep?

Puzzled...
Show 23 quoted lines
> Originally reported as https://bugzilla.redhat.com/show_bug.cgi?id=863780
>
> Signed-off-by: Adam Tkac <atkac@redhat.com>
> Signed-off-by: Holger Arnold <holgerar@gmail.com>
> ---
>  contrib/completion/git-completion.bash | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 0960acc..79073c2 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -565,7 +565,7 @@ __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 $(git help -a| \egrep '^  [a-zA-Z0-9]')
>  	do
>  		case $i in
>  		*--*)             : helper pattern;;
> -- 
> 1.8.0
Previous: Adam TkacNext: Junio C Hamano
Message 2 of 6 in “If `egrep` is aliased, temporary disable it in bash.completion”
  1. If `egrep` is aliased, temporary disable it in bash.completionAdam Tkac, Nov 29, 2012
  2. Junio C HamanoNov 29, 2012
  3. Junio C HamanoNov 29, 2012
  4. Adam TkacDec 6, 2012
  5. Junio C HamanoDec 6, 2012
  6. Felipe ContrerasDec 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.