Re: subtree split includes unrelated commits
From: Douglas Leonard <hidden>
Date: 2021-06-25 00:58:24
I hope I got this reply sent to the right thread.
I found the issue to be related with the following change in git-subtree.sh:
quoted
Revision: 933cfeb90b5d03b4096db6d60494a6eedea25d03 Author: Dave Ware [off-list ref] Date: 15.01.2016 01:41:43 Message: contrib/subtree: fix "subtree split" skipped-merge bug
quoted
'git subtree split' can incorrectly skip a merge even when both parents act on the subtree, provided the merge results in a tree identical to one of the parents. Fix by copying the merge if at least one parent is non-identical, and the non-identical parent is not an ancestor of the identical parent.
Hmm... I'm not expert on the implementation details of subtree split. But I wonder if this should have said "if at least one parent is non-subtree-identical"? Maybe that's what was meant. I just went through writing a similar "degenerate merge" (to adopt the filter-repo terminology for it) detection for git-alltrees, although I'm not sure alltrees would handle this particular case to your liking either. I think I discard merges if either parent is subtree-identical to the merge commit, probably keeping only the matching branch, but I'm not sure that's always true, and that's there, not here. Cheers, Doug