Skip to content

Commit

Permalink
Merge pull request #1160 from jelmer/memory-repo-fetch-fix
Browse files Browse the repository at this point in the history
Fix fetching into MemoryRepo
  • Loading branch information
jelmer authored Mar 14, 2023
2 parents dcdafdf + e83796c commit d87326a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Deprecate ``dulwich.objects.parse_commit``.

* Fix fetching into MemoryRepo. (Jelmer Vernooij, #1157)

0.21.3 2023-02-17

* Add support for ``worktreeconfig`` extension.
Expand Down
10 changes: 10 additions & 0 deletions dulwich/object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,16 @@ def abort():

return f, commit, abort

def add_pack_data(self, count: int, unpacked_objects: Iterator[UnpackedObject], progress=None) -> None:
"""Add pack data to this object store.
Args:
count: Number of items to add
pack_data: Iterator over pack data tuples
"""
for unpacked_object in unpacked_objects:
self.add_object(unpacked_object.sha_file())

def add_thin_pack(self, read_all, read_some, progress=None):
"""Add a new thin pack to this object store.
Expand Down
6 changes: 6 additions & 0 deletions dulwich/tests/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ def test_set_description(self):
r.set_description(description)
self.assertEqual(description, r.get_description())

def test_pull_into(self):
r = MemoryRepo.init_bare([], {})
repo = open_repo("a.git")
self.addCleanup(tear_down_repo, repo)
repo.fetch(r)


class RepositoryRootTests(TestCase):
def mkdtemp(self):
Expand Down

0 comments on commit d87326a

Please sign in to comment.