Re: subtree split includes unrelated commits
- From
- Douglas Leonard <dleonard.dev@gmail.com>
- Date
- Jun 25, 2021, 00:58 UTC
- Message-ID
- <CADdMKP8kY-ry4ZWmp1hLCne328cC4thgavbkXOjdaNpD_ockSg@mail.gmail.com>
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:
Show 5 quoted lines
> > Revision: 933cfeb90b5d03b4096db6d60494a6eedea25d03 > > Author: Dave Ware <davidw@realtimegenomics.com> > > Date: 15.01.2016 01:41:43 > > Message: > > contrib/subtree: fix "subtree split" skipped-merge bug
Show 5 quoted lines
> > '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