git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: Miles Bader <miles@gnu.org>
Cc: Wincent Colaiuta <win@wincent.com>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Christian Couder <chriscool@tuxfamily.org>,
	Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Subject: Re: [PATCH 1/3] git-bisect: war on "sed"
Date: Thu, 15 Nov 2007 11:06:33 +0100	[thread overview]
Message-ID: <473C1A29.2010703@op5.se> (raw)
In-Reply-To: <buotznnesw9.fsf@dhapc248.dev.necel.com>

Miles Bader wrote:
> Wincent Colaiuta <win@wincent.com> writes:
>> the shorter form without sed is arguably more readable:
>>
>> -		echo "$head" | sed 's#^refs/heads/##' >"$GIT_DIR/head-name"
>> +		echo "${head#refs/heads/}" >"$GIT_DIR/head-name"
> 
> Er, I suppose -- if you are acquainted with that particular shell
> variable syntax (I suspect knowledge of sed is far more widespread).
> 
> [personally, I know that syntax has something to do with replacing
> something with something else, but really haven't much clue other than
> that, and I always _thought_ it was bash-specific and so avoided using
> any of that stuff.]
> 

It says "remove refs/heads/ from the beginning of the string pointed to
by $head".

It's not a bashism. Some extensions to that syntax are though (I think).
If you want to be sure of portability, use sed instead. git uses this
syntax often enough that it's worth using everywhere, but usually only
in porcelain commands which one can relatively safely assume are run on
at least decently up-to-date developer workstations.

You'll note that stuff that absolutely *has* to reside server-side are
entirely in C.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

  reply	other threads:[~2007-11-15 10:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-15  7:18 [PATCH v2] Bisect reset: remove bisect refs that may have been packed Christian Couder
2007-11-15  8:18 ` Junio C Hamano
2007-11-15  8:27   ` Johannes Sixt
2007-11-15  8:49     ` Shawn O. Pearce
2007-11-15  8:52       ` Jeff King
2007-11-15 12:10         ` Johannes Schindelin
2007-11-15  8:34   ` Junio C Hamano
2007-11-15  9:00 ` [PATCH 1/3] git-bisect: war on "sed" Junio C Hamano
2007-11-15  9:29   ` Miles Bader
2007-11-15  9:36     ` Wincent Colaiuta
2007-11-15  9:53       ` Miles Bader
2007-11-15 10:06         ` Andreas Ericsson [this message]
2007-11-15 10:14           ` David Kastrup
     [not found]         ` <86tznn4y7v.fsf@lola.quinscape.zz>
2007-11-15 11:00           ` Miles Bader
2007-11-15 11:18             ` David Kastrup
2007-11-15 12:59               ` Miles Bader
2007-11-15  9:01 ` [PATCH 2/3] git-bisect: use update-ref to mark good/bad commits Junio C Hamano
2007-11-15  9:01 ` [PATCH 3/3] git-bisect: modernize branch shuffling hack 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=473C1A29.2010703@op5.se \
    --to=ae@op5.se \
    --cc=Ralf.Wildenhues@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=miles@gnu.org \
    --cc=win@wincent.com \
    /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).