diff --git a/hgitaly/branch.py b/hgitaly/branch.py index c8b2258783454f34b19d5d348de430e049fbd559_aGdpdGFseS9icmFuY2gucHk=..17b256dd77ff46387eadaae88103eb6d48a56396_aGdpdGFseS9icmFuY2gucHk= 100644 --- a/hgitaly/branch.py +++ b/hgitaly/branch.py @@ -108,6 +108,9 @@ if not len(repo): return None + if gl_branch is None: + return None + gl_branches = gitlab_branches(repo) if gl_branches is not GITLAB_BRANCHES_MISSING: sha = gl_branches.get(gl_branch) diff --git a/hgitaly/gitlab_ref.py b/hgitaly/gitlab_ref.py index c8b2258783454f34b19d5d348de430e049fbd559_aGdpdGFseS9naXRsYWJfcmVmLnB5..17b256dd77ff46387eadaae88103eb6d48a56396_aGdpdGFseS9naXRsYWJfcmVmLnB5 100644 --- a/hgitaly/gitlab_ref.py +++ b/hgitaly/gitlab_ref.py @@ -41,6 +41,8 @@ :returns: a :class:`changectx` instance, for the unfiltered version of ``repo``. The changeset itself may be obsolete. """ + if ref_path is None: + return None name = parse_special_ref(ref_path) if name is None: return None diff --git a/hgitaly/tests/test_branch.py b/hgitaly/tests/test_branch.py index c8b2258783454f34b19d5d348de430e049fbd559_aGdpdGFseS90ZXN0cy90ZXN0X2JyYW5jaC5weQ==..17b256dd77ff46387eadaae88103eb6d48a56396_aGdpdGFseS90ZXN0cy90ZXN0X2JyYW5jaC5weQ== 100644 --- a/hgitaly/tests/test_branch.py +++ b/hgitaly/tests/test_branch.py @@ -221,6 +221,7 @@ }) assert gitlab_branch_head(repo, b'branch/default') == default + assert gitlab_branch_head(repo, None) is None assert gitlab_branch_head(repo, b'branch/typo') is None assert dict(iter_gitlab_branches(repo)) == { diff --git a/hgitaly/tests/test_gitlab_ref.py b/hgitaly/tests/test_gitlab_ref.py index c8b2258783454f34b19d5d348de430e049fbd559_aGdpdGFseS90ZXN0cy90ZXN0X2dpdGxhYl9yZWYucHk=..17b256dd77ff46387eadaae88103eb6d48a56396_aGdpdGFseS90ZXN0cy90ZXN0X2dpdGxhYl9yZWYucHk= 100644 --- a/hgitaly/tests/test_gitlab_ref.py +++ b/hgitaly/tests/test_gitlab_ref.py @@ -56,6 +56,7 @@ # empty repo, the file doesn't even exist assert gitlab_special_ref_target(repo, ref_path) is None + assert gitlab_special_ref_target(repo, None) is None base = wrapper.commit_file('foo') write_gitlab_special_ref(repo, ref_name, base)