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

Re: [RFC/PATCH] git-completion.bash: remove bashism to fix ZSH compatibility

From
Paul Smith <paul@mad-scientist.net>
Date
Mar 11, 2013, 18:19 UTC
Message-ID
<1363025984.24833.19.camel@pdsdesk>
In-Reply-To
<7vwqtd95bm.fsf@alter.siamese.dyndns.org>
On Mon, 2013-03-11 at 11:09 -0700, Junio C Hamano wrote:
> So strictly speaking there is no reason for an extra subshell here,
> but writing this in the way the patch does makes our intention
> crystal clear, I think.

If you're concerned about the extra processing of the new shell you can use {} instead of ():

        {
            test -n "${CDPATH+set}" && unset CDPATH
            # NOTE: $2 is not quoted in order to support multiple options
            cd "$1" && git ls-files --exclude-standard $2
        } 2>/dev/null

Zsh does support this properly in my testing. It's only redirection of an entire function body, as the original, that is working differently in zsh and bash.

Previous: Junio C HamanoNext: Manlio Perillo
Message 11 of 12 in “git-completion.bash: remove bashism to fix ZSH compatibility”
  1. git-completion.bash: remove bashism to fix ZSH compatibilityMatthieu Moy, Mar 11, 2013
  2. Junio C HamanoMar 11, 2013
  3. Junio C HamanoMar 11, 2013
  4. Matthieu MoyMar 11, 2013
  5. Junio C HamanoMar 11, 2013
  6. Manlio PerilloMar 11, 2013
  7. Manlio PerilloMar 11, 2013
  8. Junio C HamanoMar 11, 2013
  9. Matthieu MoyMar 11, 2013
  10. Junio C HamanoMar 11, 2013
  11. Paul SmithMar 11, 2013
  12. Manlio PerilloMar 11, 2013

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.