Skip to content

Commit ad00c77

Browse files
committed
Spell self.Index as self.INDEX in IndexFile.diff
Because, as noted in 65863a2, it is now (slightly) preferable to write INDEX. Note that this is solely stylstic: they are equivalent and must remain so, so that existing code that uses GitPython and accesses it as Index (including in overridden diff methods when subclassing Diffable) continues to work. This changes it in the exception message as well.
1 parent 97d9b65 commit ad00c77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: git/index/base.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ def diff(
15001500
if self._file_path != self._index_path():
15011501
raise AssertionError("Cannot call %r on indices that do not represent the default git index" % self.diff())
15021502
# Index against index is always empty.
1503-
if other is self.Index:
1503+
if other is self.INDEX:
15041504
return git_diff.DiffIndex()
15051505

15061506
# Index against anything but None is a reverse diff with the respective item.
@@ -1514,12 +1514,12 @@ def diff(
15141514
# Invert the existing R flag.
15151515
cur_val = kwargs.get("R", False)
15161516
kwargs["R"] = not cur_val
1517-
return other.diff(self.Index, paths, create_patch, **kwargs)
1517+
return other.diff(self.INDEX, paths, create_patch, **kwargs)
15181518
# END diff against other item handling
15191519

15201520
# If other is not None here, something is wrong.
15211521
if other is not None:
1522-
raise ValueError("other must be None, Diffable.Index, a Tree or Commit, was %r" % other)
1522+
raise ValueError("other must be None, Diffable.INDEX, a Tree or Commit, was %r" % other)
15231523

15241524
# Diff against working copy - can be handled by superclass natively.
15251525
return super().diff(other, paths, create_patch, **kwargs)

0 commit comments

Comments
 (0)