References which fail check_refname_format() cause the whole import to fail. This might be undesirable if the references are not important. A better solution would be to provide some mapping, either by some reversible encoding, or by generating and storing the associations locally. But this is already going to allow working with many existing repositories. --- If there is no smarter solution ongoing maybe this could be useful. contrib/remote-helpers/git-remote-hg | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg index 0194c67..e32003b 100755 --- a/contrib/remote-helpers/git-remote-hg +++ b/contrib/remote-helpers/git-remote-hg @@ -591,6 +591,17 @@ def list_head(repo, cur): print "@refs/heads/%s HEAD" % head g_head = (head, node) +def print_list_entry_if_valid(ref): + # same checks as in check_refname_format() in refs.c + if ref.startswith('.') or ref.find('/.') != -1 or \ + ref.find('..') != -1 or \ + any([(c <= ' ' or c in '~^:\\\177') for c in ref]) or \ + ref.endswith('/') or \ + ref.endswith('.lock'): + warn("Ill-named reference '%s' skipped" % ref) + else: + print "? %s" % ref + def do_list(parser): global branches, bmarks, track_branches @@ -611,15 +622,15 @@ def do_list(parser): if track_branches: for branch in branches: - print "? refs/heads/branches/%s" % gitref(branch) + print_list_entry_if_valid("refs/heads/branches/%s" % gitref(branch)) for bmark in bmarks: - print "? refs/heads/%s" % gitref(bmark) + print_list_entry_if_valid("refs/heads/%s" % gitref(bmark)) for tag, node in repo.tagslist(): if tag == 'tip': continue - print "? refs/tags/%s" % gitref(tag) + print_list_entry_if_valid("refs/tags/%s" % gitref(tag)) print -- 1.8.4.rc3.902.g80a4b9e -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html