37
37
38
38
39
39
class Object (LazyMixin ):
40
- """An Object which may be :class:`~git.objects.blob.Blob`,
41
- :class:`~git.objects.tree.Tree`, :class:`~git.objects.commit.Commit` or
42
- `~git.objects.tag.TagObject`."""
40
+ """Base class for classes representing kinds of git objects.
41
+
42
+ The following leaf classes represent specific kinds of git objects:
43
+
44
+ * :class:`Blob <git.objects.blob.Blob>`
45
+ * :class:`Tree <git.objects.tree.Tree>`
46
+ * :class:`Commit <git.objects.commit.Commit>`
47
+ * :class:`TagObject <git.objects.tag.TagObject>`
48
+
49
+ See gitglossary(7) on:
50
+
51
+ * "object": https://git-scm.com/docs/gitglossary#def_object
52
+ * "object type": https://git-scm.com/docs/gitglossary#def_object_type
53
+ * "blob": https://git-scm.com/docs/gitglossary#def_blob_object
54
+ * "tree object": https://git-scm.com/docs/gitglossary#def_tree_object
55
+ * "commit object": https://git-scm.com/docs/gitglossary#def_commit_object
56
+ * "tag object": https://git-scm.com/docs/gitglossary#def_tag_object
57
+
58
+ :note:
59
+ See the :class:`git.types.Commit_ish` union type.
60
+
61
+ :note:
62
+ :class:`~git.objects.submodule.base.Submodule` is defined under the hierarchy
63
+ rooted at this :class:`Object` class, even though submodules are not really a
64
+ kind of git object.
65
+
66
+ """
43
67
44
68
NULL_HEX_SHA = "0" * 40
45
69
NULL_BIN_SHA = b"\0 " * 20
@@ -54,6 +78,20 @@ class Object(LazyMixin):
54
78
__slots__ = ("repo" , "binsha" , "size" )
55
79
56
80
type : Union [Lit_commit_ish , None ] = None
81
+ """String identifying (a concrete :class:`Object` subtype for) a kind of git object.
82
+
83
+ The subtypes that this may name correspond to the kinds of git objects that exist,
84
+ i.e., the objects that may be present in a git repository.
85
+
86
+ :note:
87
+ Most subclasses represent specific types of git objects and override this class
88
+ attribute accordingly. This attribute is ``None`` in the :class:`Object` base
89
+ class, as well as the :class:`IndexObject` intermediate subclass, but never
90
+ ``None`` in concrete leaf subclasses representing specific kinds of git objects.
91
+
92
+ :note:
93
+ See also :class:`~git.types.Commit_ish`.
94
+ """
57
95
58
96
def __init__ (self , repo : "Repo" , binsha : bytes ):
59
97
"""Initialize an object by identifying it by its binary sha.
@@ -174,9 +212,12 @@ def stream_data(self, ostream: "OStream") -> "Object":
174
212
175
213
176
214
class IndexObject (Object ):
177
- """Base for all objects that can be part of the index file, namely
178
- :class:`~git.objects.tree.Tree`, :class:`~git.objects.blob.Blob` and
179
- :class:`~git.objects.submodule.base.Submodule` objects."""
215
+ """Base for all objects that can be part of the index file.
216
+
217
+ The classes representing kinds of git objects that can be part of the index file are
218
+ :class:`~git.objects.tree.Tree and :class:`~git.objects.blob.Blob`. In addition,
219
+ :class:`~git.objects.submodule.base.Submodule` is also a subclass.
220
+ """
180
221
181
222
__slots__ = ("path" , "mode" )
182
223
0 commit comments