]> git.99rst.org Git - git.git/commit
revision: add next_commit_to_show()
authorPablo Sabater <redacted>
Tue, 14 Jul 2026 12:09:33 +0000 (14:09 +0200)
committerJunio C Hamano <redacted>
Tue, 14 Jul 2026 14:32:51 +0000 (07:32 -0700)
commit08a0bef796e3a1de6b5d08d7958bc122faf32f15
tree7e471da272cbfdaba6f59be97a83c6e4eea84ac8
parent641588bbcd1e80e084881d547e10aca8b32c328e
revision: add next_commit_to_show()

get_revision() gets its commits from two sources depending on the mode:

1. Normally it gets the commits from get_revision_internal().

2. --max-count-oldest which was introduced at bb4ce23284 (revision.c:
   implement --max-count-oldest, 2026-05-19) gets the commits by popping
   from a saved list at revs->commits marking SHOWN and CHILD_SHOWN on
   each popped commit.

Extract the choice logic into a helper, next_commit_to_show(), which
returns the next commit regardless of the source it comes from.

This has no change in behavior. The helper is needed in a subsequent
commit that pre-fetches two commits into a buffer for lookahead purposes
and needs to pre-fetch from the same source.

The --reverse branch keeps its own pop loop. Using the helper for
--reverse would additionally set SHOWN and CHILD_SHOWN which is not
desired and a behavior change.

Signed-off-by: Pablo Sabater <redacted>
Signed-off-by: Junio C Hamano <redacted>
revision.c
git clone https://git.99rst.org/PROJECT