git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: List all commits of a specified file in oldest to newest order

From
Jeff King <peff@peff.net>
Date
Nov 5, 2021, 23:26 UTC
Message-ID
<YYW9mfsyemUsBezG@coredump.intra.peff.net>
In-Reply-To
<xmqq7ddmxwtc.fsf@gitster.g>
On Fri, Nov 05, 2021 at 11:49:03AM -0700, Junio C Hamano wrote:
Show 17 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > 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 ;-)

I admit that I did not know if it would work either until I tried it earlier today. ;)

-Peff
Previous: Junio C HamanoNext: Vipul Kumar
Message 4 of 9 in “List all commits of a specified file in oldest to newest order”
  1. Vipul KumarNov 5, 2021
  2. Jeff KingNov 5, 2021
  3. Junio C HamanoNov 5, 2021
  4. Jeff KingNov 5, 2021
  5. Vipul KumarNov 9, 2021
  6. Ævar Arnfjörð BjarmasonNov 5, 2021
  7. Vipul KumarNov 9, 2021
  8. Ævar Arnfjörð BjarmasonNov 9, 2021
  9. Vipul KumarDec 14, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.