Re: List all commits of a specified file in oldest to newest order
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 5, 2021, 18:49 UTC
- Message-ID
- <xmqq7ddmxwtc.fsf@gitster.g>
- In-Reply-To
- <YYTorS1DiuTXv0/V@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> As a workaround, you can get what you want by two separate traversals: > one to collect the commits via --follow, and then another to actually > show them (but without doing any further walking). Like: > > git log --follow --format=%H -- $your_file | > git log --stdin --no-walk --reverse [--oneline, -p, etc]
We learn new things every day.
Knowing the implementation, it is sort of obvious (we push the objects into the pending list, populate the revs.commits in prepare_revision_walk() from the pending list in order, get_revision() first reverses the revs.commits and then gives out the elements), but I didn't know the combination of "--no-walk" and "--reverse" did something sensible ;-)
Thanks.