Re: [PATCH v6 2/3] revision: add peek functions for lookahead
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 21, 2026, 01:48 UTC
- Message-ID
- <xmqqwlvsek8v.fsf@gitster.g>
- In-Reply-To
- <20260620-ps-pre-commit-indent-v6-2-cdc6d8fd5fbc@gmail.com>
Pablo Sabater <pabloosabaterr@gmail.com> writes:
Show 12 quoted lines
> +int revision_has_commits_after (struct rev_info *revs, int n)
> +{
> + struct topo_walk_info *info = revs->topo_walk_info;
> +
> + if (info) {
> + int visible = 0;
> + for (size_t i = 0; i < info->topo_queue.nr && visible < n; i++) {
> + struct commit *c = info->topo_queue.array[i].data;
> + if (get_commit_action(revs, c) == commit_show)
> + visible++;
> + }
> + return visible > n-1;The loop needs to be rethought, perhaps with a better abstraction than ".nr is the number of elements in the queue and we can walk them over as a dense array", using prio_queue_for_each(), once this topic meets the kk/prio-queue-get-put-fusion topic.
I see Kristofer is already on the CC: line. Depending on the done-ness of the topic, we may want to include the topic in the updated base for this topic to resolve semantic conflicts early, or the other way around (i.e., let this topic graduate first and then rebuild the prio-queue topic on top of the updated 'master').
Thanks.