Skip to content

Commit ffc514f

Browse files
authored
Ammend the doc-string of Repository.diff()
According to the old documentation, it was not clear how to compare working directory/index to a git object.
1 parent c57a3ae commit ffc514f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pygit2/repository.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,23 @@ def diff(self, a=None, b=None, cached=False, flags=GIT_DIFF_NORMAL,
322322
323323
Keyword arguments:
324324
325+
a
326+
None, a str (that refers to an Object, see revparse_single()) or a
327+
Reference object.
328+
If None, b must be None, too. In this case the working directory is
329+
compared with the index. Otherwise the referred object is compared to
330+
'b'.
331+
332+
b
333+
None, a str (that refers to an Object, see revparse_single()) or a
334+
Reference object.
335+
If None, the working directory is compared to 'a'. (except
336+
'cached' is True, in which case the index is compared to 'a').
337+
Otherwise the referred object is compared to 'a'
338+
325339
cached
326-
use staged changes instead of workdir
340+
if 'b' is None, by default the working directory is compared to 'a'.
341+
If 'cached' is set to True, the index/staging area is used for comparing.
327342
328343
flag
329344
a GIT_DIFF_* constant

0 commit comments

Comments
 (0)