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

Re: Buggy `git log -- path` behavior

From
MDMatthew DeVore <matvore@pobox.com>
Date
Mar 17, 2023, 16:46 UTC
Message-ID
<ae193764-daf2-4fff-89cf-39396f420cb3@app.fastmail.com>
In-Reply-To
<ZBH7Uiv7fH9UnB4v@coredump.intra.peff.net>
On Wed, Mar 15, 2023, at 12:07, Jeff King wrote:
Show 13 quoted lines
> I think what you're seeing is the correct output, though, due to history
> simplification. Along the first-parent history, for example,
> Documentation/vm/pagemap.rst never existed.  And so since it does not
> exist now, we prune any side branches where it did (because they did not
> lead to the current state; the other side of the merge resolution did).
> 
> Tracking down the exact sequence of merges is tricky ("git log --graph"
> is unreadably huge here). But it looks like the file was added by
> ad56b738c5dd (docs/vm: rename documentation files to .rst, 2018-03-21).
> That was merged into docs-next via 24844fd33945 (Merge branch 'mm-rst'
> into docs-next, 2018-04-16), which then eventually moved it in
> 1ad1335dc586 (docs/admin-guide/mm: start moving here files from
> Documentation/vm, 2018-04-18).

This was thought-provoking. ad56b738c5dd is a side-branch. I expected a path filter to find changes since git log would show this commit when invoked with no other args.

But the only reason git follows the side branch in the filterless or 'pagemap.*' case is because git sees pagemap.txt (matching the glob) in the first-parent line being removed when the side branch is merged into this first-parent line.

As I usually use --name-status as a default in my workflow, I was surprised git log couldn't find something that grep could :)

Thank you for the thorough explanation despite my terse complaint.
Previous: Jeff King
Message 3 of 3 in “Buggy `git log -- path` behavior”
  1. Matthew DeVoreMar 15, 2023
  2. Jeff KingMar 15, 2023
  3. Matthew DeVoreMar 17, 2023

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.