Changeset 4f730ba2f61d…
Parent b91ee1c3222b…
by
Changes to one file · Browse files at 4f730ba2f61d Showing diff from parent b91ee1c3222b Diff from another changeset...
@@ -20,7 +20,6 @@ """Git object store interfaces and implementation."""
-import errno
import itertools
import os
import stat
@@ -312,19 +311,6 @@ return ShaFile.from_file(path)
return None
- def _add_shafile(self, sha, o):
- dir = os.path.join(self.path, sha[:2])
- if not os.path.isdir(dir):
- os.mkdir(dir)
- path = os.path.join(dir, sha[2:])
- if os.path.exists(path):
- return # Already there, no need to write again
- f = GitFile(path, 'wb')
- try:
- f.write(o.as_legacy_object())
- finally:
- f.close()
-
def get_raw(self, name):
"""Obtain the raw text for an object.
@@ -430,7 +416,17 @@
:param obj: Object to add
"""
- self._add_shafile(obj.id, obj)
+ dir = os.path.join(self.path, obj.id[:2])
+ if not os.path.isdir(dir):
+ os.mkdir(dir)
+ path = os.path.join(dir, obj.id[2:])
+ if os.path.exists(path):
+ return # Already there, no need to write again
+ f = GitFile(path, 'wb')
+ try:
+ f.write(obj.as_legacy_object())
+ finally:
+ f.close()
def add_objects(self, objects):
"""Add a set of objects to this object store.
|
Loading...