diff options
Diffstat (limited to 'git/db')
-rw-r--r-- | git/db/py/loose.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/git/db/py/loose.py b/git/db/py/loose.py index 56915f18..6e72aff0 100644 --- a/git/db/py/loose.py +++ b/git/db/py/loose.py @@ -107,22 +107,6 @@ class PureLooseObjectODB(PureRootPathDB, PureObjectDBR, PureObjectDBW): # END handle cache raise BadObject(hexsha) - def partial_to_complete_sha_hex(self, partial_hexsha): - """:return: 20 byte binary sha1 string which matches the given name uniquely - :param name: hexadecimal partial name - :raise AmbiguousObjectName: - :raise BadObject: """ - candidate = None - for binsha in self.sha_iter(): - if bin_to_hex(binsha).startswith(partial_hexsha): - # it can't ever find the same object twice - if candidate is not None: - raise AmbiguousObjectName(partial_hexsha) - candidate = binsha - # END for each object - if candidate is None: - raise BadObject(partial_hexsha) - return candidate #} END interface @@ -179,6 +163,23 @@ class PureLooseObjectODB(PureRootPathDB, PureObjectDBR, PureObjectDBW): except BadObject: return False # END check existance + + def partial_to_complete_sha_hex(self, partial_hexsha): + """:return: 20 byte binary sha1 string which matches the given name uniquely + :param name: hexadecimal partial name + :raise AmbiguousObjectName: + :raise BadObject: """ + candidate = None + for binsha in self.sha_iter(): + if bin_to_hex(binsha).startswith(partial_hexsha): + # it can't ever find the same object twice + if candidate is not None: + raise AmbiguousObjectName(partial_hexsha) + candidate = binsha + # END for each object + if candidate is None: + raise BadObject(partial_hexsha) + return candidate def store(self, istream): """note: The sha we produce will be hex by nature""" |