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

Re: path-restricted log vs. subtree merges

From
Jeff King <peff@peff.net>
Date
Mar 17, 2025, 17:43 UTC
Message-ID
<20250317174343.GA704253@coredump.intra.peff.net>
In-Reply-To
<Z9WSbUQw4VBQiOqi@ugly>
On Sat, Mar 15, 2025 at 03:45:01PM +0100, Oswald Buddenhagen wrote:
Show 12 quoted lines
> in my quest to prepare for hacking git-gui, i ran
> 
>   cd .../git/git-gui
>   git log .
> 
> the result is ... unhelpful. apart from a few commits that were done
> directly in the git repo, there are only merges. notably, there is no
> trace of the commits that are being merged (and the way gitk presents
> this partial log is even more unhelpful).
> 
> i'm speculating that this is the result of git log not handling the
> subtree merges in any way, with somewhat predictable consequences.

Yes, the merged-in paths and the paths in the original commits are different. So the merge will update path "git-gui/git-gui.sh", etc, but the individual commits are touching "git-gui.sh" at the root of the tree (in the git-gui repository).

Leaving aside for a moment how --follow and other tooling could help, the workaround in this case is:

  git log -- git-gui/ git-gui.sh lib/

You need to ask for the paths you care about at the root-level (since that's what the individual commits from the git-gui repo will have). But you also need to include git-gui/; otherwise history simplification will not go down the side branches from the git-gui repo (you can also use --full-history, but that would include a lot of irrelevant stuff). And you need to use "--" before the paths, since the rev/path dwim logic will only treat an argument as a path if it is present in the working tree (which the latter two paths are not).

-Peff
Previous: Junio C Hamano
Message 4 of 4 in “path-restricted log vs. subtree merges”
  1. Oswald BuddenhagenMar 15, 2025
  2. Johannes SchindelinMar 16, 2025
  3. Junio C HamanoMar 16, 2025
  4. Jeff KingMar 17, 2025

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.