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

Re: [PATCH] git-prompt.sh: shorter equal upstream branch name

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 30, 2014, 22:35 UTC
Message-ID
<xmqq7g0krb2p.fsf@gitster.dls.corp.google.com>
In-Reply-To
<542B1623.2070109@bbn.com>
Richard Hansen <rhansen@bbn.com> writes:
> Additional cases could be added to handle git-svn if needed.
Thanks for a review (everything I omitted above looked good to me).
>> +				__git_ps1_upstream_name=${__git_ps1_upstream_name/$__head/=}
>
>   * This could break if ${__head} contains any pattern-special
>     characters.

... but I do not think refnames can have *, ? and such so it may not be relevant ;-).

>   * While this syntax works in both Bash and Zsh (assuming no
>     pattern-special characters), my preference is to stick to POSIX[1]
>     when possible.

Nah. The existing script is full of bash-isms like local you suggested to add (and other constructs like shell arrays and [[ ]] tests, I suspect), and there is no hope to "fix" them to stick to the bare-minimum POSIX, and there is no need to do so (isn't this bash-prompt script after all?)

>   * I don't think the CodingGuidelines explicitly prohibit long lines
>     for shell code, and this file already contains plenty of long
>     lines, but I really dislike lines longer than 80 characters.

Yes, I dislike overlong lines, too. But I also dislike lines that are artificially chopped into shorter pieces without good reason ;-).

Previous: Richard HansenNext: Richard Hansen
Message 3 of 9 in “git-prompt.sh: shorter equal upstream branch name”
  1. git-prompt.sh: shorter equal upstream branch nameJulien Carsique, Sep 30, 2014
  2. Richard HansenSep 30, 2014
  3. Junio C HamanoSep 30, 2014
  4. Richard HansenOct 1, 2014
  5. Junio C HamanoOct 1, 2014
  6. Julien CarsiqueOct 7, 2014
  7. Richard HansenOct 7, 2014
  8. Junio C HamanoOct 7, 2014
  9. Junio C HamanoSep 30, 2014

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.