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