Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

repo.index.diff("HEAD", create_patch=True) always empty #852

Copy link
Copy link
Closed
@jadinm

Description

@jadinm
Issue body actions

I am using GitPython v2.1.11 with Python 3.6. My git version is 2.17.1.

I see inconsistent behavior of the diff method of a repo index if create_patch option set to True.
I am running the following script in a git repository with staged and unstaged changes.

from git import Repo

repo = Repo(".")

print(repo.index.diff("HEAD"))
print(repo.index.diff("HEAD", create_patch=True)) # Problem here

print(repo.index.diff(None))
print(repo.index.diff(None, create_patch=True))

But it prints:

[<git.diff.Diff object at 0x7fd54c328678>, <git.diff.Diff object at 0x7fd549e405e8>, <git.diff.Diff object at 0x7fd54c328558>]
[]
[<git.diff.Diff object at 0x7fd54c328678>]
[<git.diff.Diff object at 0x7fd54c328678>]

Somehow, the diff is empty if I set create_patch to True and the first argument to anything but None.
Do you know why it happens ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.