Skip to content

Commit

Permalink
git: don't assume default branch is named master
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed Sep 28, 2024
1 parent cec7094 commit 4ee2c72
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions xandikos/store/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ def __init__(
self,
repo,
*,
ref: bytes = b"refs/heads/master",
ref: bytes = b"HEAD",
check_for_duplicate_uids=True,
**kwargs,
) -> None:
super().__init__(MemoryIndex(), **kwargs)
self.ref = ref
self.ref = repo.refs.follow(ref)[0][-1]
self.repo = repo
# Maps uids to (sha, fname)
self._uid_to_fname: dict[str, tuple[bytes, str]] = {}
Expand Down
2 changes: 1 addition & 1 deletion xandikos/tests/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_git_refs(self):
self.store.import_one("foo.ics", "text/calendar", [EXAMPLE_VCALENDAR1])
app = XandikosApp(self.backend, "user")

default_branch = b"refs/heads/master"
default_branch = self.store.repo.refs.follow(b"HEAD")[0][-1]
commit_hash = self.store.repo.refs[default_branch]

environ = {"PATH_INFO": "/c/.git/info/refs", "REQUEST_METHOD": "GET", "QUERY_STRING": ""}
Expand Down

0 comments on commit 4ee2c72

Please sign in to comment.