Subject: Re: How Does "git log --reverse" Work?

From: Junio C Hamano <[email-masked]>
Date: Tue, 30 Dec 2025 11:04:42 +0900

Jon Forrest <[email-masked]> writes:

> I've looked at the code but it's not well commented.
> Does the answer have something to do with commit lists?

What revision.c:get_revision() does should be fairly obvious.

When the .reverse option is in effect, it grabs all the commits it
needs to show (with the usual traversal, as if .reverse were not in
effect, by calling get_revision_internal()), queues it in the
.commits list, goes into the reverse output stage, where we output
what we queued earlier.  After that, we yield commits from that
queue.