mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2026-05-07 01:16:26 +02:00
Do not fail on invalid bookmarks
Mercurial can have bookmarks pointing to "nullid" (the empty root revision), while Git can not have references to it. Warn the user about the invalid reference, and do not advertise these bookmarks as head refs, but otherwise continue the import. In particular, we still keep track of the fact that the remote repository has a bookmark of the given name, in case the user wants to modify that bookmark. Reported-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Max Horn <max@quendi.de> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
committed by
Felipe Contreras
parent
184551c71d
commit
1c72617831
@@ -648,7 +648,10 @@ def do_list(parser):
|
||||
print "? refs/heads/branches/%s" % gitref(branch)
|
||||
|
||||
for bmark in bmarks:
|
||||
print "? refs/heads/%s" % gitref(bmark)
|
||||
if bmarks[bmark].hex() == '0' * 40:
|
||||
warn("Ignoring invalid bookmark '%s'", bmark)
|
||||
else:
|
||||
print "? refs/heads/%s" % gitref(bmark)
|
||||
|
||||
for tag, node in repo.tagslist():
|
||||
if tag == 'tip':
|
||||
|
||||
25
test/main.t
25
test/main.t
@@ -773,4 +773,29 @@ test_expect_success 'remote double failed push' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'clone remote with null bookmark, then push' '
|
||||
test_when_finished "rm -rf gitrepo* hgrepo*" &&
|
||||
|
||||
(
|
||||
hg init hgrepo &&
|
||||
cd hgrepo &&
|
||||
echo a > a &&
|
||||
hg add a &&
|
||||
hg commit -m a &&
|
||||
hg bookmark -r null bookmark
|
||||
) &&
|
||||
|
||||
(
|
||||
git clone "hg::hgrepo" gitrepo &&
|
||||
check gitrepo HEAD a &&
|
||||
cd gitrepo &&
|
||||
git checkout --quiet -b bookmark &&
|
||||
git remote -v &&
|
||||
echo b > b &&
|
||||
git add b &&
|
||||
git commit -m b &&
|
||||
git push origin bookmark
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user