]> git.ipfire.org Git - thirdparty/git.git/commit
revision: introduce rev_walk_mode to clarify get_revision_1()
authorKristofer Karlsson <krka@spotify.com>
Wed, 27 May 2026 15:50:01 +0000 (15:50 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 May 2026 21:08:20 +0000 (06:08 +0900)
commitd877b1af507a6aaf55e8643eb73277a30d3a800b
tree4f4e00e2972a80270c7e1e1f43f3d807cf573406
parent9f4e170dfc3bd8cdd284f1c4411b25ce1d09737f
revision: introduce rev_walk_mode to clarify get_revision_1()

get_revision_1() dispatches to different walk strategies based on a
combination of rev_info flags: reflog_info, topo_walk_info, and
limited.  These conditions are checked in multiple places within
the function -- once to select the next commit, and again to decide
how to expand parents -- and the two chains must stay in sync.

Extract the mode selection into a rev_walk_mode enum and a small
get_walk_mode() helper, resolved once at the top of get_revision_1().
Both dispatch sites now switch on the same mode variable, making it
obvious that they agree and easier to verify that all modes are
handled.

No functional change.

Signed-off-by: Kristofer Karlsson <krka@spotify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c