git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC v2] revision: Add --sticky-default option

From
AGAndreas Gruenbacher <agruenba@redhat.com>
Date
Oct 18, 2018, 12:52 UTC
Message-ID
<CAHc6FU7iZN6t-mN=nrAptg7WgeDGXVpKwZawSq80+S-bKH1isg@mail.gmail.com>
In-Reply-To
<20181018065328.GC23537@sigill.intra.peff.net>
On Thu, 18 Oct 2018 at 08:53, Jeff King <peff@peff.net> wrote:
Show 29 quoted lines
> 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.
Yes, this still needs fixing, I'm just not sure yet if this is the right way.

Thanks, Andreas

Previous: Jeff King
Message 3 of 3 in “[RFC v2] revision: Add --sticky-default option”
  1. Andreas GruenbacherOct 17, 2018
  2. Jeff KingOct 18, 2018
  3. Andreas GruenbacherOct 18, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.