Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct and clarify Diffable.diff docstring
In cd16a35 (gitpython-developers#1725), I had taken "Treeish" to mean the type of that exact name, git.index.base.Treeish. But that type is only used within the git.index package (actually only in git.index.base itself). It is also nonpublic: git.index.base.__all__ exists and does not list it. So most likely this was not intended in the git.diff.Diffable.diff docstring. Even if intended, it does not appear accurate, since the git.index.base.Treeish union includes bytes, and the logic in Diffable.diff and its helpers does not appear to accommodate bytes. A closer type is the public git.types.Tree_ish union, which is narrower than git.index.base.Treeish, including neither str nor bytes. However, it does not include str, and Diffable.diff does accept str to specify a tree-ish for diff-ing. It may be that "Treeish" in the pre-gitpython-developers#1725 docstring was capitalized for some reason 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 also explicitly documented that a string can be used to specify a tree-ish -- which is independently valuable, since previously the effect of passing a str instance to the diff method was not stated anywhere in the method docstring. To clarify further, I included a link to tree-ish in gitglossary(7) as well. In addition, the original wording before cd16a35 had included "(type)", which I had erroneously assumed was just meant to state that it is a type (i.e. a class), so I had wrongly removed it without replacing it with anything when making it into a reference to a type. But it was really an attempt to clarify that Diffable.Index should be used directly, rather than an instance of it. That is in effect the opposite of merely pointing out that it is a class; it is to express that it should be used in a way that does not depend in any way on it being a class. This commit has the docstring explicitly state that.
- Loading branch information