git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Hansen <rhansen@bbn.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Julien Carsique" <julien.carsique@gmail.com>,
	git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>,
	"Felipe Contreras" <felipe.contreras@gmail.com>,
	"Ramkumar Ramachandra" <artagnon@gmail.com>,
	"Simon Oosthoek" <s.oosthoek@xs4all.nl>,
	"Eduardo R. D'Avila" <erdavila@gmail.com>
Subject: Re: [PATCH] git-prompt.sh: shorter equal upstream branch name
Date: Tue, 30 Sep 2014 23:54:32 -0400	[thread overview]
Message-ID: <542B7AF8.6080501@bbn.com> (raw)
In-Reply-To: <xmqq7g0krb2p.fsf@gitster.dls.corp.google.com>

On 2014-09-30 18:35, Junio C Hamano wrote:
> Richard Hansen <rhansen@bbn.com> writes:
>>   * 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),

True.

> and there is no hope to "fix" them to stick to
> the bare-minimum POSIX,

I don't think it'd be hard to convert it to pure POSIX if there was a
desire to do so.  The biggest challenge would be 'local', which would
require subshells or uniquified prefixed global variables.  Both of
those are likely to make the code a bit grotesque.

> and there is no need to do so (isn't this
> bash-prompt script after all?)

It would be unwise to go to great lengths to avoid Bashisms, but I think
it would be smart to use POSIX syntax when it is easy to do so.  Rarely
is it hard or awkward to use POSIX syntax ('local' and arrays are two
major exceptions), so Bashisms like the ${//} expansion in this patch
are usually unnecessary divergences from a ubiquitous standard.  POSIX
is a stable foundation, and it's easy to get POSIX shell code to run
consistently on all POSIX-like shells.

One of these days I'll try converting git-prompt.sh to POSIX -- I'm
curious to see how bad it would be.

-Richard

  reply	other threads:[~2014-10-01  4:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30 15:36 [PATCH] git-prompt.sh: shorter equal upstream branch name Julien Carsique
2014-09-30 20:44 ` Richard Hansen
2014-09-30 22:35   ` Junio C Hamano
2014-10-01  3:54     ` Richard Hansen [this message]
2014-10-01 17:49       ` Junio C Hamano
2014-10-07 15:57         ` Julien Carsique
2014-10-07 19:42           ` Richard Hansen
2014-10-07 20:10           ` Junio C Hamano
2014-09-30 22:29 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=542B7AF8.6080501@bbn.com \
    --to=rhansen@bbn.com \
    --cc=artagnon@gmail.com \
    --cc=erdavila@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=julien.carsique@gmail.com \
    --cc=s.oosthoek@xs4all.nl \
    --cc=szeder@ira.uka.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).