git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Kirill Smelkov <kirr@landau.phys.spbu.ru>,
	git@vger.kernel.org, Axel Bonnet <axel.bonnet@ensimag.imag.fr>,
	Cl??ment Poulain <clement.poulain@ensimag.imag.fr>,
	Diane Gasselin <diane.gasselin@ensimag.imag.fr>,
	Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Subject: Re: [PATCH v3 1/3] tests: Prepare --textconv tests for correctly-failing conversion program
Date: Tue, 28 Sep 2010 11:58:45 -0400	[thread overview]
Message-ID: <20100928155845.GA10271@sigill.intra.peff.net> (raw)
In-Reply-To: <7vlj6lubg1.fsf@alter.siamese.dyndns.org>

On Tue, Sep 28, 2010 at 08:36:46AM -0700, Junio C Hamano wrote:

> >> >  cat >helper <<'EOF'
> >> >  #!/bin/sh
> >> > -sed 's/^/converted: /' "$@" >helper.out
> >> > +grep -q '^bin: ' "$@" || { echo "E: $@ is not \"binary\" file" 1>&2; exit 1; }
> >>  ...
> > ...
> > I too think (1) is right. It was just that originally there was $@
> > (which I now understand was wrong).
> 
> Well, the original's use of "$@" is perfectly fine; it would do the right
> thing with one argument, of course, but it would do the right thing with
> more than one, too.  On the other hand, your use inside "echo" is not.

Moreover, the use of "grep" is wrong. Giving it two files, one of which
has "^bin: " and one of which doesn't, will silently accept the latter.
If it's going to handle multiple files, it must be a for-loop (or you
could invert "grep -qv", but I think that might be getting too clever to
remain readable).

Which is why I suggested just dropping the t4042 bit, which is the only
part that actually needs to handle multiple arguments. The other ones
can just switch to using "$1". The helper script is simple enough that
there is no need for them to share the same code.

-Peff

  reply	other threads:[~2010-09-28 15:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-24 18:24 [BUG, PATCH v3 0/3] Fix {blame,cat-file} --textconv for cases with symlinks Kirill Smelkov
2010-09-24 18:24 ` [PATCH v3 1/3] tests: Prepare --textconv tests for correctly-failing conversion program Kirill Smelkov
2010-09-27 18:23   ` Junio C Hamano
2010-09-28 12:07     ` Kirill Smelkov
2010-09-28 12:20       ` Kirill Smelkov
2010-09-28 12:41         ` Kirill Smelkov
2010-09-28 13:23       ` Jeff King
2010-09-28 14:35         ` Kirill Smelkov
2010-09-28 14:39           ` Jeff King
2010-09-28 15:09             ` Kirill Smelkov
2010-09-28 15:36       ` Junio C Hamano
2010-09-28 15:58         ` Jeff King [this message]
2010-09-28 16:12           ` Kirill Smelkov
2010-09-29 11:44             ` Kirill Smelkov
2010-09-24 18:24 ` [PATCH v3 2/3] blame,cat-file: Demonstrate --textconv is wrongly running converter on symlinks Kirill Smelkov
2010-09-27 18:27   ` Junio C Hamano
2010-09-28 12:07     ` Kirill Smelkov
2010-09-24 18:24 ` [PATCH v3 3/3] blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664'' Kirill Smelkov

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=20100928155845.GA10271@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=axel.bonnet@ensimag.imag.fr \
    --cc=clement.poulain@ensimag.imag.fr \
    --cc=diane.gasselin@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kirr@landau.phys.spbu.ru \
    /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).