Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork944
Commited6ead9
committed
Correct and clarify Diffable.diff docstring
Incd16a35 (#1725), I had taken "Treeish" to mean the type of thatexact name, git.index.base.Treeish. But that type is only usedwithin the git.index package (actually only in git.index.baseitself). It is also nonpublic: git.index.base.__all__ exists anddoes not list it.So most likely this was not intended in the git.diff.Diffable.diffdocstring. Even if intended, it does not appear accurate, since thegit.index.base.Treeish union includes bytes, and the logic inDiffable.diff and its helpers does not appear to accommodate bytes.A closer type is the public git.types.Tree_ish union, which isnarrower than git.index.base.Treeish, including neither str norbytes. However, it does not include str, and Diffable.diff doesaccept str to specify a tree-ish for diff-ing. It may be that"Treeish" in the pre-#1725 docstring was capitalized for somereason other than to identify a type defined in GitPython's code.For now, I've changed it to refer to git.types.Tree_ish, but alsoexplicitly documented that a string can be used to specify atree-ish -- which is independently valuable, since previously theeffect of passing a str instance to the diff method was not statedanywhere in the method docstring. To clarify further, I included alink to tree-ish in gitglossary(7) as well.In addition, the original wording beforecd16a35 had included"(type)", which I had erroneously assumed was just meant to statethat it is a type (i.e. a class), so I had wrongly removed itwithout replacing it with anything when making it into a referenceto a type. But it was really an attempt to clarify thatDiffable.Index should be used directly, rather than an instance ofit. That is in effect the opposite of merely pointing out that itis a class; it is to express that it should be used in a way thatdoes not depend in any way on it being a class. This commit has thedocstring explicitly state that.1 parent1cdec7a commited6ead9
1 file changed
+16
-7
lines changedLines changed: 16 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
122 | 122 |
| |
123 | 123 |
| |
124 | 124 |
| |
125 |
| - | |
126 |
| - | |
127 |
| - | |
128 |
| - | |
129 |
| - | |
130 |
| - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
131 | 140 |
| |
132 | 141 |
| |
133 | 142 |
| |
| |||
143 | 152 |
| |
144 | 153 |
| |
145 | 154 |
| |
146 |
| - | |
| 155 | + | |
147 | 156 |
| |
148 | 157 |
| |
149 | 158 |
| |
|
0 commit comments
Comments
(0)