RFC: git subrepos

Matt Mackall mpm at selenic.com
Tue Nov 9 16:05:59 CST 2010


On Tue, 2010-11-09 at 14:05 -0600, Kevin Bullock wrote:
> On Nov 9, 2010, at 10:55 AM, Matt Mackall wrote:
> 
> > On Tue, 2010-11-09 at 01:06 -0500, Eric Eisner wrote:
> >> - Updating to a specific git commit loses the git branch.
> >>    Even if there is a branch there, should hg check it out?
> >>    What if there is more than one branch at a commit?
> >> - If git does not have a branch checked out, a further commit is not
> >> officially referenced and thus never pushed and may be subject to
> >> garbage collection.
> >> - 'git push' pushes branches, not commits
> > 
> > Ok, here's a simple scenario:
> > 
> > State 0: Alice clones git project X, checking out branch Y at changeset A1
> > State 1: Alice commits changeset A2 to branch Y
> > State 2: Alice pushes
> >         Bob pulls, commits B1-B5 to branch Y
> > State 3: Alice commits changeset A3 to branch Y
> > 
> > Git presumably allows the above. Git presumably also allows us to clone
> > Bob's repo, and force the clone into a state where it's at A2 and the
> > next commit will be on branch Y, thus emulating Alice's 'natural'
> > transition above from state 2 to state 3.
> 
> What git does is to create a new ref—in state 1, Alice has branches:
> 
> origin/Y -> parent(A1)
> Y -> A2
> 
> When she pushes, (IIUC) origin/Y (which is just Y on the upstream repo) points to A2. In state 3, Alice has [if she's pulled from Bob]:

Actually, she hasn't in my scenario.

> Y -> A3
> origin/Y -> B5
> 
> I believe git will complain about that situation if Alice tries to
> commit w/o first merging origin/Y or setting a new branch name. What I
> suggested on IRC was to detect that situation in recursive commit and
> abort, telling the user to set a branch name (possibly providing a
> convenience option a la `hg commit --git-branch BRANCHNAME` to do it
> in one step).

Aborting is fine.

> There's a related situation for push: Assume Alice didn't pull Bob's
> changes. Now, if she tries to push, upstream git will fail, telling
> her to pull and merge.

..which is no different than Mercurial.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list