git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Beyer <s-beyer@gmx.net>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: git@vger.kernel.org,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH 2/3] rebase-i: slight internal improvements
Date: Fri, 20 Jun 2008 10:01:53 +0200	[thread overview]
Message-ID: <20080620080153.GC7369@leksak.fem-net> (raw)
In-Reply-To: <485B595B.80608@viscovery.net>

Hi,

On Fri, Jun 20, 2008 at 09:16:43AM +0200, Johannes Sixt wrote:
> If by "other slight improvements" you mean ...
> 
> >  mark_action_done () {
> > -	sed -e 1q < "$TODO" >> "$DONE"
> > -	sed -e 1d < "$TODO" >> "$TODO".new
> > -	mv -f "$TODO".new "$TODO"
> > -	count=$(grep -c '^[^#]' < "$DONE")
> > -	total=$(($count+$(grep -c '^[^#]' < "$TODO")))
> > +	sed -e 1q "$TODO" >>"$DONE"
> > +	sed -e 1d "$TODO" >>"$TODO.new"
> > +	mv -f "$TODO.new" "$TODO"
> > +	count="$(grep -c '^[^#]' "$DONE")"
> > +	total="$(expr "$count" + "$(grep -c '^[^#]' "$TODO")")"
> 
> ... this ...
> 
> >  has_action () {
> > -	grep '^[^#]' "$1" >/dev/null
> > +	grep -q '^[^#]' "$1"
> 
> ... and this, etc, then they are not improvements. They make the script
> less portable:

Ok, great to know.

> There are 'grep's that don't have -q,

Well, it's always a little hard to say what is understood by most of the
implementations.  POSIX says, there is grep -q and a few git test
scripts and the Makefile uses it, too.

Ok, so I've looked for a list "the least common denominator of shell
commands you can use to be portable" on the net and found the 
GNU Autoconf documentation:
http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_node/autoconf_123.html
Looks like *portable* shell programming is no fun :\

> others write the file name in front of the count,

I did not really change anything that's related to the count, btw.


Regards,
  Stephan

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

  reply	other threads:[~2008-06-20  8:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-20  2:45 some small changes for rebase-i Stephan Beyer
2008-06-20  2:45 ` [PATCH 1/3] t3404: slight improvements Stephan Beyer
2008-06-20  2:45   ` [PATCH 2/3] rebase-i: slight internal improvements Stephan Beyer
2008-06-20  2:45     ` [PATCH 3/3] Make rebase--interactive use OPTIONS_SPEC Stephan Beyer
2008-06-20  5:48       ` Stephan Beyer
2008-06-20 13:15       ` Johannes Schindelin
2008-06-20 18:30         ` [PATCH 1/2] t3404: extra checks and s/! git/test_must_fail git/ Stephan Beyer
2008-06-20 18:30           ` [PATCH 2/2] Make rebase--interactive use OPTIONS_SPEC Stephan Beyer
2008-06-20 18:48           ` [PATCH 1/2] t3404: extra checks and s/! git/test_must_fail git/ Brandon Casey
2008-06-20 19:00             ` Stephan Beyer
2008-06-20 22:18             ` しらいしななこ
2008-06-21  1:46               ` Stephan Beyer
2008-06-21  9:46                 ` Junio C Hamano
2008-06-21 23:55                   ` [PATCH v3 1/2] t3404: stricter tests for git-rebase--interactive Stephan Beyer
2008-06-21 23:55                     ` [PATCH v3 2/2] Make rebase--interactive use OPTIONS_SPEC Stephan Beyer
2008-06-20  7:16     ` [PATCH 2/3] rebase-i: slight internal improvements Johannes Sixt
2008-06-20  8:01       ` Stephan Beyer [this message]
2008-06-20  8:17         ` Johannes Sixt
2008-06-20 12:46         ` Johannes Schindelin
2008-06-20 18:45           ` Stephan Beyer
2008-06-20 13:05   ` [PATCH 1/3] t3404: slight improvements Johannes Schindelin

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=20080620080153.GC7369@leksak.fem-net \
    --to=s-beyer@gmx.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    /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).