Subject: Re: [PATCH] revision.c: implement --reverse=before for walks

From: Mirko Faina <[email-masked]>
Date: Tue, 21 Apr 2026 01:50:32 +0200

On Mon, Apr 20, 2026 at 09:06:44AM -0700, Junio C Hamano wrote:
> Tian Yuchen <[email-masked]> writes:
> 
> > I think the space complexity here could be reduced a little. After all, 
> > since we’re only retrieving a few commits, there’s no need to load the 
> > entire reversed commit history into memory.
> 
> Does "we're only retrieving a few commits" come from the fact that
> the command example is "log --reverse -3"?  
> 
>  - What should happen when you give "git log --reverse=before"
>    without "--max-count=3"?
> 
>  - What should happen without "--max-count" but other limiting
>    options, like "--author=Tian" or "--min-parents=2"?
> 
> It might be that the right way to look at this new feature is not
> that "we are changing where reverse is applied", but "count limit is
> applied much later than usual", which may mean at the UI level, it
> may not be good at the conceptual level to sell this as an extension
> to the "--reverse" option?  I dunno.

I'm not sure about that. The way max_count actually interacts with
--reverse in the code is an implementation detail that the user doesn't
need to worry about. It should be fine to tell the user that this
feature is an extention of how --reverse behaves. Regarding "Commit
Limiting options", we already tell the user

	Note that these are applied before commit ordering and formatting
	options, such as --reverse.

so explaining to the user that this new feature acts on reverse's
behaviour might be easier (and not necessarily wrong on a conceptual
level). I find "you can choose to apply reverse before any commit
limiting option" easier to understand than "--max-count can be applied
last, or before reverse but after all other Commit Limiting options".