From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] notes remove: --stdin reads from the standard input
Date: Thu, 19 May 2011 14:02:05 -0400 [thread overview]
Message-ID: <20110519180205.GA26564@sigill.intra.peff.net> (raw)
In-Reply-To: <7vliy27exx.fsf@alter.siamese.dyndns.org>
On Thu, May 19, 2011 at 10:55:38AM -0700, Junio C Hamano wrote:
> >> + if (from_stdin) {
> >> + struct strbuf sb = STRBUF_INIT;
> >> + while (strbuf_getwholeline(&sb, stdin, '\n') != EOF) {
> >> + int len = sb.len;
> >> + if (len && sb.buf[len - 1] == '\n')
> >> + sb.buf[--len] = '\0';
> >> + retval |= remove_one_note(t, sb.buf, flag);
> >> + }
> >> + }
> >
> > Wouldn't strbuf_rtrim (or even strbuf_trim) be useful here?
>
> Thanks for noticing.
>
> I just mimicked what was done to the result of strbuf_getwholeline() in
> other places (I think from revision.c but I am not sure).
I am tempted to say that other callsites should be "upgraded" to
strbuf_trim. Is there any reason we should not be liberal in accepting
something like:
echo " refs/heads/foo " | git rev-list --stdin
?
I guess for pathspecs we would want to be more literal, though, so maybe
it is a stupid idea.
> An incremental correction, relative to what I had in 'pu' overnight, looks
> like this.
Thanks. BTW, I was too busy picking this one nit to mention that the
general direction of the series is a nice improvement. :)
-Peff
next prev parent reply other threads:[~2011-05-19 18:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-19 0:14 [PATCH 0/3] "git notes remove" updates Junio C Hamano
2011-05-19 0:14 ` [PATCH 1/3] notes remove: allow removing more than one Junio C Hamano
2011-05-19 6:43 ` Michael J Gruber
2011-05-19 6:50 ` Junio C Hamano
2011-05-19 7:31 ` Michael J Gruber
2011-05-19 17:44 ` Junio C Hamano
2011-05-19 18:47 ` [PATCH 1/2] fixup! notes remove: --ignore-missing Michael J Gruber
2011-05-19 18:47 ` [PATCH 2/2] fixup! notes remove: --stdin reads from the standard input Michael J Gruber
2011-05-19 0:14 ` [PATCH 2/3] notes remove: --missing-ok Junio C Hamano
2011-05-19 2:00 ` Junio C Hamano
2011-05-19 0:14 ` [PATCH 3/3] notes remove: --stdin reads from the standard input Junio C Hamano
2011-05-19 6:50 ` Michael J Gruber
2011-05-19 10:50 ` Jeff King
2011-05-19 17:55 ` Junio C Hamano
2011-05-19 18:02 ` Jeff King [this message]
2011-05-19 2:03 ` [PATCH 4/3] show: --ignore-missing Junio C Hamano
2011-05-19 7:08 ` [PATCH 0/3] "git notes remove" updates Johan Herland
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=20110519180205.GA26564@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).