Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Pablo Sabater <pabloosabaterr@gmail.com>
Cc: Kristofer Karlsson <krka@spotify.com>,
	git@vger.kernel.org, ayu.chandekar@gmail.com,
	chandrapratap3519@gmail.com, christian.couder@gmail.com,
	gitster@pobox.com, jltobler@gmail.com, karthik.188@gmail.com,
	phillip.wood@dunelm.org.uk, siddharthasthana31@gmail.com
Subject: Re: [PATCH v5 2/2] graph: indent visual root in graph
Date: Thu, 18 Jun 2026 12:05:04 -0400	[thread overview]
Message-ID: <20260618160504.GA818042@coredump.intra.peff.net> (raw)
In-Reply-To: <CAN5EUNSQY2oK7BE4J9Y8APfkP6eJxta050OUu=RoJYhXOjX_OA@mail.gmail.com>

On Thu, Jun 18, 2026 at 02:42:16PM +0200, Pablo Sabater wrote:

> > > +     for (cl = graph->revs->commits; cl; cl = cl->next) {
> > > +             if (get_commit_action(graph->revs, cl->item) != commit_show)
> > > +                     continue;
> [...]
> > I'm not sure what the solution is. This function wants to peek ahead in
> > queue order, possibly through multiple entries. But a heap-based queue
> > inherently only supports peeking at the first entry.
> 
> Yeah, I haven't read dd4bc01c0a yet but from what you say it prob
> won't work anymore, I didn't know about that series, about the
> lookahead I think it could still work with some tweaks, the important
> part is to set the three lookahead flags.

Thanks for looking into it. I meant to also cc the Kristofer, the author
of dd4bc01c0a, for any thoughts (adding him now).

> From what I understood, we can only get the direct next commit, but no
> more reliably ordered.

Right. There are other queue implementations that could allow full
in-order traversal (e.g., a binary tree), but our prio_queue does not. I
suspect performance for other cases would suffer if we switched the
underlying data structure.

> The flags should be fine:
> 
> - 'is_next_visible' could need to traverse multiple entries, but it
> doesn't need them to be in order. We just need to know if something
> will be rendered after.

Yeah, this one seems easy. We are just setting a bit based on whether
we'd find any commit to show. So order doesn't matter.

> - 'next_has_column' only needs the first entry.

But this was the one I was worried about. Walking the linked list in
order will find us the next commit we're going to show, and the result
of the flag depends on graph_find_new_column_by_commit(). Is it OK to
find _any_ such commit?

(I'm looking at this purely based on reading the existing code, and
haven't really thought hard about the problem space).

> - 'is_next_visual_root' only needs the first entry to know if it could
> be a visual root, and also if it is not the last one (but we don't
> need them to be ordered for this last part).

This one just iterates looking for any other commit we'll show after the
next one. So finding any two entries would be equivalent to the current
code (though we only get to this loop if the first one passes the test
for graph_is_visual_root_candidate).

So if you say order doesn't matter for checking the column and the
visual-root-candidate function, I'm happy to believe you. It makes life
much easier. :)

> Should I work with 'next' as a base to have dd4bc01c0a? (Sorry I've
> just worked with master).

As Junio noted, that's already in master, so I think you're OK to just
base there.

But for future reference, no, you probably don't want to build off of
'next'. If your commit has a dependency on another topic it is best to
build directly off of that topic (and note it in the cover letter of the
series). That way you do not accidentally depend on other things in
'next' which might not ever make it to 'master' (and would thus hold
your topic hostage).

-Peff

  parent reply	other threads:[~2026-06-18 16:05 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 21:17 [GSoC RFC PATCH 0/1] graph: add indentation for commits preceded by a root Pablo Sabater
2026-04-02 21:17 ` [GSoC RFC PATCH 1/1] " Pablo Sabater
2026-04-03 17:55   ` Junio C Hamano
2026-04-03 18:07     ` Pablo
2026-04-03  5:04 ` [GSoC RFC PATCH 0/1] " Junio C Hamano
2026-04-03  8:25   ` Pablo
2026-04-04  9:24 ` [GSoC RFC PATCH v2 0/1] graph: add indentation for commits preceded by a parentless commit Pablo Sabater
2026-04-04  9:24   ` [GSoC RFC PATCH v2 1/1] " Pablo Sabater
2026-04-10 16:25   ` [GSoC RFC PATCH v2 0/1] " Pablo
2026-04-10 16:54     ` Junio C Hamano
2026-04-27 10:28   ` [GSoC PATCH v3 " Pablo Sabater
2026-04-27 10:28     ` [GSoC PATCH v3 1/1] " Pablo Sabater
2026-05-13 23:02       ` Jeff King
2026-05-14 10:19         ` Pablo Sabater
2026-04-27 10:35     ` [GSoC PATCH v3 0/1] " Pablo
2026-06-12 13:48     ` [PATCH v4 0/2] graph: indent visual roots in graph Pablo Sabater
2026-06-12 13:48       ` [PATCH v4 1/2] lib-log-graph: move check_graph function Pablo Sabater
2026-06-12 13:48       ` [PATCH v4 2/2] graph: indent visual root in graph Pablo Sabater
2026-06-13  3:01       ` [PATCH v4 0/2] graph: indent visual roots " Junio C Hamano
2026-06-13 19:09       ` [PATCH v5 " Pablo Sabater
2026-06-13 19:09         ` [PATCH v5 1/2] lib-log-graph: move check_graph function Pablo Sabater
2026-06-13 19:09         ` [PATCH v5 2/2] graph: indent visual root in graph Pablo Sabater
2026-06-14  4:05           ` Junio C Hamano
2026-06-14  5:28             ` Pablo Sabater
2026-06-15 15:42               ` Junio C Hamano
2026-06-16 13:06                 ` Pablo Sabater
2026-06-16 16:36                   ` Junio C Hamano
2026-06-17 20:27           ` Jeff King
2026-06-18 12:42             ` Pablo Sabater
2026-06-18 13:31               ` Junio C Hamano
2026-06-18 16:05               ` Jeff King [this message]
2026-06-18 16:07                 ` Jeff King
2026-06-17 10:33         ` [PATCH v5 0/2] graph: indent visual roots " Chandra Pratap
2026-05-14 15:15 ` [GSoC RFC PATCH 0/1] graph: add indentation for commits preceded by a root Phillip Wood
2026-05-14 17:45   ` Pablo Sabater
2026-05-15  9:33     ` Phillip Wood
2026-05-17  6:31       ` Chandra Pratap
2026-05-18 13:26         ` Pablo Sabater
2026-05-19  0:03           ` Junio C Hamano
2026-05-19  5:59             ` Pablo Sabater
2026-06-10 15:21               ` Junio C Hamano
2026-06-10 15:28                 ` Pablo Sabater
2026-05-19 10:39           ` Chandra Pratap

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=20260618160504.GA818042@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=ayu.chandekar@gmail.com \
    --cc=chandrapratap3519@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jltobler@gmail.com \
    --cc=karthik.188@gmail.com \
    --cc=krka@spotify.com \
    --cc=pabloosabaterr@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=siddharthasthana31@gmail.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