1
- """Module with our own gitdb implementation - it uses the git command"""
1
+ """Module with our own gitdb implementation - it uses the git command."""
2
+
2
3
from git .util import bin_to_hex , hex_to_bin
3
4
from gitdb .base import OInfo , OStream
4
5
from gitdb .db import GitDB
22
23
23
24
24
25
class GitCmdObjectDB (LooseObjectDB ):
25
-
26
26
"""A database representing the default git object store, which includes loose
27
- objects, pack files and an alternates file
27
+ objects, pack files and an alternates file.
28
28
29
29
It will create objects only in the loose object database.
30
- :note: for now, we use the git command to do all the lookup, just until he
31
- have packs and the other implementations
30
+
31
+ :note: For now, we use the git command to do all the lookup, just until we
32
+ have packs and the other implementations.
32
33
"""
33
34
34
35
def __init__ (self , root_path : PathLike , git : "Git" ) -> None :
35
- """Initialize this instance with the root and a git command"""
36
+ """Initialize this instance with the root and a git command. """
36
37
super (GitCmdObjectDB , self ).__init__ (root_path )
37
38
self ._git = git
38
39
@@ -48,11 +49,15 @@ def stream(self, binsha: bytes) -> OStream:
48
49
# { Interface
49
50
50
51
def partial_to_complete_sha_hex (self , partial_hexsha : str ) -> bytes :
51
- """:return: Full binary 20 byte sha from the given partial hexsha
52
+ """
53
+ :return: Full binary 20 byte sha from the given partial hexsha
54
+
52
55
:raise AmbiguousObjectName:
53
56
:raise BadObject:
54
- :note: currently we only raise BadObject as git does not communicate
55
- AmbiguousObjects separately"""
57
+
58
+ :note: Currently we only raise :class:`BadObject` as git does not communicate
59
+ AmbiguousObjects separately.
60
+ """
56
61
try :
57
62
hexsha , _typename , _size = self ._git .get_object_header (partial_hexsha )
58
63
return hex_to_bin (hexsha )
0 commit comments