On Thu, Nov 1, 2012 at 12:14 AM, Daniel Barkalow <barka...@iabervon.org> wrote:

> I think that may be true where you have "next" in both places, but I
> think:
> $ git checkout -b new-branch master
> $ git fast-export ^master new-branch
> ought to emit no "commit" lines, but needs to emit a "reset" line. After
> all, you haven't told fast-export that the ref "new-branch" is up to date,
> and you have told it that you want it to be exported. If you create a new
> branch off of an existing commit, don't change it, and push it to hg, it
> shouldn't be up to remote-hg to figure out what should happen with no
> input; it should get a:
> reset refs/heads/new-branch
> from [something]
> I don't know why Johannes seems to want [something] not to be a mark
> reference (unless he's complaining about getting an invalid mark
> reference when there aren't any marks defined), but surely something of
> the above form is necessary to tell remote-hg to create the new branch.

I don't know what Johannes wants, but it has been discussed that not
everybody is using marks.

When you use marks, the following patch fixes the issue:


> I think it would be worth testing that:
> $ git checkout -b new-branch master
> $ git push hg new-branch
> creates the new branch successfully (which I think it does, but wouldn't
> if "git fast-export ^master new-branch" actually returned nothing;
> parsed_refs gets it from the reset line).

And it does, with the above patch, a similar command is even in the tests.

The reason why 'git fast-export ^master new-branch' returning nothing
doesn't affect, is that transport helpers wouldn't use negative refs
(e.g. ^master). Transport helper passes whatever the uses specifies. I
you say 'new-branch', that's exactly what the transport helper will
receive. It works because transport helpers use marks.

Nobody expects '^master new-branch' to do something useful, everybody
uses marks.

> AFAICT, your code relies on getting the behavior that fast-export actually
> gives, not the behavior you seem to want or the behavior Johannes seems to
> want. And the reason that you don't need any changes to fast-export is
> that your process maps marks instead of sha1s.

No. In order to make use of this bug, the user would have to do:

% git push hg ^master new-branch

Otherwise nothing would get pushed, with or without my first patch[1].
To make 'git push hg new-branch' work, you need my second patch[2].


[1] http://article.gmane.org/gmane.comp.version-control.git/208729
[2] http://article.gmane.org/gmane.comp.version-control.git/208730

Felipe Contreras
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to