Skip to content

Commit ee1acff

Browse files
authored
Merge pull request #439 from jelmer/no-autogc
Disable autogc for now, since it might cause requests to time out
2 parents ae40cf4 + 5df66f0 commit ee1acff

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

xandikos/store/git.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ def __init__(
219219
super().__init__(MemoryIndex(), **kwargs)
220220
self.ref = repo.refs.follow(ref)[0][-1]
221221
self.repo = repo
222+
# Disable automatic garbage collection
223+
self.repo._autogc_disabled = True
222224
# Maps uids to (sha, fname)
223225
self._uid_to_fname: dict[str, tuple[bytes, str]] = {}
224226
self._check_for_duplicate_uids = check_for_duplicate_uids
@@ -409,7 +411,9 @@ def open_from_path(cls, path, **kwargs):
409411
Returns: A `GitStore`
410412
"""
411413
try:
412-
return cls.open(dulwich.repo.Repo(path), **kwargs)
414+
repo = dulwich.repo.Repo(path)
415+
repo._autogc_disabled = True
416+
return cls.open(repo, **kwargs)
413417
except dulwich.repo.NotGitRepository:
414418
raise NotStoreError(path)
415419

@@ -600,7 +604,8 @@ def create_memory(cls) -> "GitStore":
600604
601605
Returns: A `GitStore`
602606
"""
603-
return cls(dulwich.repo.MemoryRepo())
607+
repo = dulwich.repo.MemoryRepo()
608+
return cls(repo)
604609

605610
def _commit_tree(self, tree_id, message, author=None):
606611
return self.repo.do_commit(
@@ -672,7 +677,9 @@ def create(cls, path):
672677
Returns: A `GitStore`
673678
"""
674679
os.mkdir(path)
675-
return cls(dulwich.repo.Repo.init_bare(path))
680+
repo = dulwich.repo.Repo.init_bare(path)
681+
repo._autogc_disabled = True
682+
return cls(repo)
676683

677684
def subdirectories(self):
678685
"""Returns subdirectories to probe for other stores.
@@ -694,7 +701,9 @@ def create(cls, path, bare=True):
694701
Returns: A `GitStore`
695702
"""
696703
os.mkdir(path)
697-
return cls(dulwich.repo.Repo.init(path))
704+
repo = dulwich.repo.Repo.init(path)
705+
repo._autogc_disabled = True
706+
return cls(repo)
698707

699708
def _get_etag(self, name):
700709
index = self.repo.open_index()

xandikos/tests/test_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,5 @@ class RepoMetadataTests(TestCase, MetadataTests):
137137
def setUp(self):
138138
super().setUp()
139139
self._repo = dulwich.repo.MemoryRepo()
140+
self._repo._autogc_disabled = True
140141
self._config = RepoCollectionMetadata(self._repo)

0 commit comments

Comments
 (0)