|
73 | 73 | See also the :class:`Tree_ish` and :class:`Commit_ish` unions.
|
74 | 74 | """
|
75 | 75 |
|
76 |
| -Tree_ish = Union["Commit", "Tree"] |
77 |
| -"""Union of :class:`~git.objects.base.Object`-based types that are inherently tree-ish. |
| 76 | +Tree_ish = Union["Commit", "Tree", "TagObject"] |
| 77 | +"""Union of :class:`~git.objects.base.Object`-based types that are sometimes tree-ish. |
78 | 78 |
|
79 | 79 | See gitglossary(7) on "tree-ish": https://git-scm.com/docs/gitglossary#def_tree-ish
|
80 | 80 |
|
81 | 81 | :note:
|
82 |
| - This union comprises **only** the :class:`~git.objects.commit.Commit` and |
83 |
| - :class:`~git.objects.tree.Tree` classes, **all** of whose instances are tree-ish. |
84 |
| - This has been done because of the way GitPython uses it as a static type annotation. |
85 |
| -
|
86 |
| - :class:`~git.objects.tag.TagObject`, some but not all of whose instances are |
87 |
| - tree-ish (those representing git tag objects that ultimately resolve to a tree or |
88 |
| - commit), is not covered as part of this union type. |
| 82 | + :class:`~git.objects.tree.Tree` and :class:`~git.objects.commit.Commit` are the |
| 83 | + classes whose instances are all tree-ish. This union includes them, but also |
| 84 | + :class:`~git.objects.tag.TagObject`, only **some** of whose instances are tree-ish. |
| 85 | + Whether a particular :class:`~git.objects.tag.TagObject` peels (recursively |
| 86 | + dereferences) to a tree or commit, rather than a blob, can in general only be known |
| 87 | + at runtime. |
89 | 88 |
|
90 | 89 | :note:
|
91 | 90 | See also the :class:`AnyGitObject` union of all four classes corresponding to git
|
|
102 | 101 | commit-ish. This union type includes :class:`~git.objects.commit.Commit`, but also
|
103 | 102 | :class:`~git.objects.tag.TagObject`, only **some** of whose instances are
|
104 | 103 | commit-ish. Whether a particular :class:`~git.objects.tag.TagObject` peels
|
105 |
| - (recursively dereferences) to a commit can in general only be known at runtime. |
106 |
| -
|
107 |
| -:note: |
108 |
| - This is an inversion of the situation with :class:`Tree_ish`. This union is broader |
109 |
| - than all commit-ish objects, while :class:`Tree_ish` is narrower than all tree-ish |
110 |
| - objects. |
| 104 | + (recursively dereferences) to a commit, rather than a tree or blob, can in general |
| 105 | + only be known at runtime. |
111 | 106 |
|
112 | 107 | :note:
|
113 | 108 | See also the :class:`AnyGitObject` union of all four classes corresponding to git
|
|
0 commit comments