All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Andreas Gruenbacher <agruenba@redhat.com>,
	git@vger.kernel.org, Bob Peterson <rpeterso@redhat.com>
Subject: Re: [RFC] revision: Add --sticky-default option
Date: Thu, 18 Oct 2018 15:59:23 +0900	[thread overview]
Message-ID: <xmqqlg6vu4dw.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20181018064845.GB23537@sigill.intra.peff.net> (Jeff King's message of "Thu, 18 Oct 2018 02:48:46 -0400")

Jeff King <peff@peff.net> writes:

> Just to play devil's advocate, how about this:
>
>   git log --branches=jk/* --not origin/master
>
> Right now that shows nothing if there are no matching branches. But I
> think under the proposed behavior, it would start showing HEAD, which
> seems counter-intuitive.
>
> Or are we going to count any positive selector as a positive ref, even
> if it matches nothing? 

That sounds like an intuitive behaviour of the command, but I may
change my mind when I look at other examples.  

When viewing that "--branches=jk/*" example in isolation, yes, these
positive selectors that could produce positive revs should defeat
the --default, especially when it is built-in (like "log").  When
given by the user, I am not sure.  With something like this:

	git rev-list --default=HEAD --branches=jk/* ^master

clearly the user anticipates that jk/* may or may not produce any
positive refs; otherwise there is no point specifying the default.

But anyway...

> I could buy that, though it means that the
> command above is subtly different from one or both of:
>
>   branches() {
>     git for-each-ref --format='%(refname)' refs/heads/jk/*
>   }
>
>   # is --stdin a selector, too?
>   branches | git log --stdin --not origin/master
>
>   # here we have no idea that the user did a query and must show HEAD
>   git log $(branches) --not origin/master

OK, scrap that---just as I predicted a few minutes ago, I now think
that "do we have a positive selector that can produce zero or more
result?" is an ill-defined question X-<.

Thanks for a doze of sanity.

  reply	other threads:[~2018-10-18  6:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 21:24 [RFC] revision: Add --sticky-default option Andreas Gruenbacher
2018-10-17  9:12 ` Jeff King
2018-10-17 13:24   ` Matthew DeVore
2018-10-17 18:11     ` Jeff King
2018-10-17 13:53   ` Andreas Gruenbacher
2018-10-17 18:13     ` Jeff King
2018-10-18  3:23       ` Junio C Hamano
2018-10-18  6:48         ` Jeff King
2018-10-18  6:59           ` Junio C Hamano [this message]
2018-10-18 12:17             ` Andreas Gruenbacher
2018-10-18 12:26               ` Junio C Hamano
2018-10-18 12:23         ` Andreas Gruenbacher

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=xmqqlg6vu4dw.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=agruenba@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=rpeterso@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.