Skip to content
Snippets Groups Projects
Commit 071cd5a0c689 authored by Georges Racinet's avatar Georges Racinet
Browse files

Default branch: fix reading from share

This was the root cause of heptapod#714: reading the value of the
GitLab default branch from Mercurial shares was not switching over to the
share source where the file is actually stored.

On the server side, Mercurial shares are used for all server-originating
operations (web edits notably) and they are not used for receiving pushes,
explaning why reproduction was only possible with web edits.
Also this happens only for native projects (nowadays always without the Git repo
to support the default branch information as `HEAD`) hence was amplified when
the mode without Git became default.

As a result, the default branch machinery was defaulting to the topic.
parent a7dc9682153a
No related branches found
No related tags found
3 merge requests!106Merge stable branch,!105Merged oldstable branch into stable,!104Fixing default GitLab ref reading from Mercurial shares
......@@ -63,6 +63,9 @@
def get_default_gitlab_branch(repo):
"""Return the default GitLab branch name, or ``None`` if not set."""
shared_from = hg.sharedreposource(repo)
if shared_from is not None:
repo = shared_from
branch = repo.vfs.tryread(DEFAULT_GITLAB_BRANCH_FILE_NAME)
# (hg 5.4) tryread returns empty strings for missing files
if not branch:
......
......@@ -39,3 +39,4 @@
assert get_default_gitlab_branch(main.repo) is None
set_default_gitlab_branch(share.repo, b'branch/default')
assert get_default_gitlab_branch(main.repo) == b'branch/default'
assert get_default_gitlab_branch(share.repo) == b'branch/default'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment