fix: use shared empty tree sha for index diffs · gitpython-developers/GitPython@fe4b66d · GitHub
Skip to content

Commit fe4b66d

Browse files
fix: use shared empty tree sha for index diffs
Assisted-by: ChatGPT
1 parent 3895682 commit fe4b66d

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

git/diff.py

Lines changed: 4 additions & 1 deletion

git/index/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,10 +1511,10 @@ def diff(
15111511
if other is self.INDEX:
15121512
return git_diff.DiffIndex()
15131513

1514-
if other is git_diff.NULL_TREE:
1514+
if other == git_diff.NULL_TREE or other == git_diff.NULL_TREE_SHA:
15151515
args: List[Union[PathLike, str]] = [
15161516
"--cached",
1517-
"4b825dc642cb6eb9a060e54bf8d69288fbee4904",
1517+
git_diff.NULL_TREE_SHA,
15181518
"--abbrev=40",
15191519
"--full-index",
15201520
]

test/test_index.py

Lines changed: 3 additions & 1 deletion

0 commit comments

Comments
 (0)