From: Nguyen Thai Ngoc Duy Date: Wed, 25 Aug 2010 06:21:25 GMT Subject: Re: [RFD PATCH 00/32] subtree clone v2 Message-ID: In-Reply-To: On Wed, Aug 25, 2010 at 3:31 PM, Elijah Newren wrote: > Sure, they will modify paths outside your subtree, but you know that > you didn't do so.  So if you neglect renames then the situation is > pretty simple: > > Merge-side: ancestor    you         upstream >            --------    --------    -------------- > Sha1sum:    ancestor    ancestor    new-stuff > > Which could be true for either a file or a tree.  Either way, if you > ignore renames, then the trivial merge is 'new-stuff' for any such > blob/tree.  (Yeah, you'd have to create a new merge algorithm that > does 'trivial' merges at tree levels in addition to file levels, but > the concept is relatively simple at least.) > > After your merge, a subsequent pull would look like this at the same > file/tree path: > > Merge-side: ancestor    you         upstream >            --------    --------    -------------- > Sha1sum:    new-stuff   new-stuff   newer-stuff > > For which the resolution would be 'newer-stuff' (again, ignoring the > problems that renames could cause, which I discussed elsewhere). > > Unless, of course, I'm missing something still... OK here is the story. And I could be wrong on this merge stuff. I was deep in merge-tree.c code (which was the base for my narrow merge) and was stuck at "If either "you" or "upstream" is as same as ancestor (all as dirs), then it's easy. What if neither of them is the same as ancestor? If we have more trees, we could just descend and figure out. But we don't because it's outside narrow area. It could be that "you" added a new file and "upstream" added another file, which is trivial at file level." I was deep in code and forgot that in narrow repo, I did not allow to change outside narrow area, so it "you" must be as same as ancestor. But the question was, what if user decides to branch from some commit in history? If he/she does, "you" might not be as same as ancestor. If it's non trivial merge, merge should fail (expected). But the "it could be that "you" added ... at file level" above bothered me. I had a feeling that I could miss a trivial merge (at file level) because I could not make a judgement at (shallow) tree level. And I did not have all trees to do merge at file level. Still puzzling thinking about this.. Did I make wrong assumptions? -- Duy