diff --git a/git-remote-hg b/git-remote-hg index 3c79daf..35f469a 100755 --- a/git-remote-hg +++ b/git-remote-hg @@ -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': diff --git a/test/main.t b/test/main.t index b8625ca..22c82f6 100755 --- a/test/main.t +++ b/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