diff --git a/dulwich/object_store.py b/dulwich/object_store.py index dec12e5d4..0ae6a2f84 100644 --- a/dulwich/object_store.py +++ b/dulwich/object_store.py @@ -887,20 +887,6 @@ def add_thin_pack(self, read_all, read_some, progress=None): copier.verify(progress=progress) return self._complete_pack(f, path, len(copier), indexer, progress=progress) - def _move_in_pack(self, path, f): - """Move a specific file containing a pack into the pack directory. - - Note: The file should be on the same file system as the - packs directory. - - Args: - path: Path to the pack file. - """ - f.seek(0) - with PackData(path, f) as pd: - indexer = PackIndexer.for_pack_data(pd, resolve_ext_ref=self.get_raw) - return self._complete_pack(f, path, len(pd), indexer) - def add_pack(self): """Add a new pack to this object store. @@ -916,7 +902,10 @@ def add_pack(self): def commit(): if f.tell() > 0: - return self._move_in_pack(path, f) + f.seek(0) + with PackData(path, f) as pd: + indexer = PackIndexer.for_pack_data(pd, resolve_ext_ref=self.get_raw) + return self._complete_pack(f, path, len(pd), indexer) else: f.close() os.remove(path)