git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH DONOTAPPLY 5/4] revision: let --stdin set rev_input_given
Date: Thu, 3 Aug 2017 13:00:02 -0400	[thread overview]
Message-ID: <20170803170002.qogk3ezvhgumnyi7@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqq3798r6ai.fsf@gitster.mtv.corp.google.com>

On Thu, Aug 03, 2017 at 08:59:33AM -0700, Junio C Hamano wrote:

> >   (echo --; echo t) | git log --stdin
> >
> > no longer defaults to HEAD. Which maybe people would see as a
> > regression. I could see arguments either way.
> 
> Yeah, thanks for thinking this through.  I do think this would be a
> regression.  On the other hand,
> 
>     (printf "%s\n" --tags=no-such -- t) | git log --stdin
> 
> should not default to HEAD and show nothing, I would think.

That was the same conclusion I got to, but it actually doesn't matter,
because we don't allow it anyway:

  $ echo --tags=no-such | git log --stdin
  fatal: options not supported in --stdin mode

If we were to make that work later, it should automatically do the right
thing with respect to rev_input_given, since the stdin code would just
call into handle_revision_arg().

> So if we wanted to do the "--stdin" thing properly, we probably need
> to keep the "--stdin" option itself neutral wrt "did we get rev
> input?"; instead, each input item that comes in from the standard
> input stream would decide if the user wants us to fall back to the
> default, perhaps?

Yes, exactly. It is a shame that scripts can't rely on an empty input to
"rev-list --stdin" to produce a empty output, though. That seems like it
would be handy. On the other hand, nobody has complained about it in the
past 10 years, so perhaps it just doesn't come up.

> Hmph.  Do you mean the former should traverse from HEAD while the
> latter should give us empty in the following two, because unlike
> "log", "rev-list" does not do the "default to HEAD" thing if it is
> not told to do so?
> 
>     git rev-list --default HEAD --stdin </dev/null
>     git rev-list --stdin </dev/null
> 
> If so, I think the reasoning makes sense.

TBH, I think both would make sense with an empty output. But it looks
like filter-branch is relying on the former to show HEAD. But like I
said, I didn't dig into whether its expectation is sane. If anybody is
interested in digging further you can apply the --stdin patch in this
thread and run t7003.

> > I didn't dig enough to see if it's actually sane or
> > not. The failing tests seem to be weird noop filters that our test
> > script uses. But I'm worried it would break some real case, too.
> 
> Thanks.  Let's not rush things.  
> 
> The ones you sent for application 1-4/4 all are improvements.

Thanks. I agree that is probably an OK stopping point, as the --stdin
behavior is largely orthogonal (it just happens to be in the same
general area).

-Peff

  reply	other threads:[~2017-08-03 17:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 22:24 [PATCH 0/4] handling empty inputs in the revision machinery Jeff King
2017-08-02 22:24 ` [PATCH 1/4] t6018: flesh out empty input/output rev-list tests Jeff King
2017-08-02 22:25 ` [PATCH 2/4] revision: add rev_input_given flag Jeff King
2017-08-02 22:41   ` Junio C Hamano
2017-08-02 23:11     ` Jeff King
2017-08-02 22:26 ` [PATCH 3/4] rev-list: don't show usage when we see empty ref patterns Jeff King
2017-08-02 22:30 ` [PATCH 4/4] revision: do not fallback to default when rev_input_given is set Jeff King
2017-08-02 22:44   ` Junio C Hamano
2017-08-02 23:22     ` Stefan Beller
2017-08-02 22:34 ` [PATCH DONOTAPPLY 5/4] revision: let --stdin set rev_input_given Jeff King
2017-08-03 15:59   ` Junio C Hamano
2017-08-03 17:00     ` Jeff King [this message]
2017-08-02 22:35 ` [PATCH 0/4] handling empty inputs in the revision machinery 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170803170002.qogk3ezvhgumnyi7@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).