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

Re: [PATCH 1/2] completion: suppress zsh's special 'words' variable

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 10, 2011, 11:43 UTC
Message-ID
<BANLkTi=C26rtgvx+kYpE0YUrwUFrEquphA@mail.gmail.com>
In-Reply-To
<20110510031708.GD26619@elie>
On Tue, May 10, 2011 at 6:17 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 39 quoted lines
> Jonathan Nieder wrote:
>
>>  contrib/completion/git-completion.bash |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> I forgot to list changes since v4:
>
>  - new commit message
>  - removed comment I considered unclear --- probably the following
>   should be squashed in, though, to prevent someone from seeing the
>   seemingly redundant "typeset -h words" and removing it, not
>   realizing it is needed for compatibility with old zsh versions.
>
> -- >8 --
> From: Felipe Contreras <felipe.contreras@gmail.com>
> Subject: completion: add a comment to explain what "typeset -h words" is for
>
> In current zsh master, bashcompinit hides the 'words' special variable
> already, so our own "typeset -h words" in _git and _gitk might seem
> redundant.  Add a comment to explain that it is there for
> compatibility with old zsh versions.
>
> [jn: based on the original comment by Felipe Contreras]
>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
>  contrib/completion/git-completion.bash |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index da586e5..b80830e 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2608,6 +2608,10 @@ _git ()
>        if [[ -n ${ZSH_VERSION-} ]]; then
>                emulate -L bash
>                setopt KSH_TYPESET
> +
> +               # Suppress the "words" special variable from zsh.

That is not accurate. This is hiding the special meaning of the 'words' variable, only locally. "Suppress" denotes that the special meaning of 'words' is gone forever, even on outer layers of the call stack.

> +               # Only zsh versions <= 4.3.11 need this --- in later
> +               # versions, bashcompinit takes care of it.
That can be explained in shorter form:
# Workaround for versions < 4.3.12

The word workaround denotes that there's a bug, and by limiting where the workaround is needed, it's obvious where proper fix is.

All this can be explained in this sentence:

# workaround zsh's bug which leaves 'words' as a special variable in versions < 4.3.12

What is the need to change that?
-- 
Felipe Contreras
Previous: Jonathan NiederNext: Felipe Contreras
Message 14 of 19 in “git-completion: fix zsh support”
  1. git-completion: fix zsh supportFelipe Contreras, May 9, 2011
  2. Jonathan NiederMay 9, 2011
  3. Felipe ContrerasMay 9, 2011
  4. git-completion: fix zsh supportFelipe Contreras, May 9, 2011
  5. Jonathan NiederMay 9, 2011
  6. Felipe ContrerasMay 9, 2011
  7. Jonathan NiederMay 9, 2011
  8. Felipe ContrerasMay 9, 2011
  9. Junio C HamanoMay 9, 2011
  10. Jonathan NiederMay 9, 2011
  11. 0/2 git-completion: fix zsh supportJonathan Nieder, May 10, 2011
  12. 1/2 completion: suppress zsh's special 'words' variableJonathan Nieder, May 10, 2011
  13. Jonathan NiederMay 10, 2011
  14. Felipe ContrerasMay 10, 2011
  15. Felipe ContrerasMay 10, 2011
  16. 2/2 completion: move private shopt shim for zsh to __git_ namespaceJonathan Nieder, May 10, 2011
  17. Felipe ContrerasMay 10, 2011
  18. Jonathan NiederMay 10, 2011
  19. Felipe ContrerasMay 10, 2011

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.