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 ;-).