git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: git@vger.kernel.org, rpeterso@redhat.com,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [RFC v2] revision: Add --sticky-default option
Date: Thu, 18 Oct 2018 02:53:29 -0400	[thread overview]
Message-ID: <20181018065328.GC23537@sigill.intra.peff.net> (raw)
In-Reply-To: <20181017134947.12571-1-agruenba@redhat.com>

On Wed, Oct 17, 2018 at 03:49:47PM +0200, Andreas Gruenbacher wrote:

> @@ -2431,7 +2446,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
>  		opt->tweak(revs, opt);
>  	if (revs->show_merge)
>  		prepare_show_merge(revs);
> -	if (revs->def && !revs->pending.nr && !revs->rev_input_given && !got_rev_arg) {
> +	if (revs->sticky_default)
> +		cancel_default = has_interesting_revisions();
> +	else
> +		cancel_default = got_rev_arg;
> +	if (revs->def && !revs->rev_input_given && !cancel_default) {

How do you want to handle "maybe has a ref" options like --stdin,
--tags, etc? Those set revs->rev_input_given.

With the code you have here, rev_input_given overrides any
sticky_default decision, and you cannot do this:

  git log --not --remotes=origin

and get the default, because even though you have only UNINTERESTING
commits, rev_input_given is true.

If you move rev_input_given to the cancel_default line above the final
conditional and turn that conditional into:

  if (revs->def && !cancel_default)

then it works.

-Peff

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 13:49 [RFC v2] revision: Add --sticky-default option Andreas Gruenbacher
2018-10-18  6:53 ` Jeff King [this message]
2018-10-18 12:52   ` 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

  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=20181018065328.GC23537@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=agruenba@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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.
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).