From: Junio C Hamano <gitster@pobox.com>
To: Richard Hansen <rhansen@bbn.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: Wed, 01 Oct 2014 10:49:56 -0700 [thread overview]
Message-ID: <xmqqppebptmj.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <542B7AF8.6080501@bbn.com> (Richard Hansen's message of "Tue, 30 Sep 2014 23:54:32 -0400")
Richard Hansen <rhansen@bbn.com> writes:
>> 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.
Not necessarily; if you make it so slow to be usable as a prompt
script, that is not a "conversion". Bash-isms in the script is
allowed for a reason, unfortunately.
> 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.
In general, I agree with you. People who know only bash tend to
overuse bash-isms where they are not necessary, leaving an
unreadable mess.
For the specific purpose of Julien's "if the tail part of this
string matches the other string, replace that with an equal sign",
${parameter/pattern/string} is a wrong bash-ism to use. But the
right solution to count the length of the other string and take a
substring of this string from its beginning would require other
bash-isms ${#parameter} and ${parameter:offset:length}.
And that's fine.
next prev parent reply other threads:[~2014-10-01 17:50 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
2014-10-01 17:49 ` Junio C Hamano [this message]
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=xmqqppebptmj.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=artagnon@gmail.com \
--cc=erdavila@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=julien.carsique@gmail.com \
--cc=rhansen@bbn.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).