Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

commit.diff(branch, create_patch=True) gets "+" and "-" backwards #1291

Open
@lhannest

Description

@lhannest

When I do this:

>>> import git>>> r = git.Repo('.')>>> from pprint import pprint>>> pprint(r.active_branch.commit.diff('master', create_patch=True)[0].diff.decode('utf-8').split('\n'))

Then I see the same first file as when I dogit diff master in the terminal. But, it gets the "+" and "-" backwards. In python I see lines such as:

...'-import static org.mockito.Matchers.anyLong;','-import static org.mockito.Matchers.anyString;','-import static org.mockito.Mockito.times;',...

But this is a file I've added in the active branch that isn't in the master! In the terminal when I dogit diff master I see:

...+import static org.mockito.Matchers.anyLong;+import static org.mockito.Matchers.anyString;+import static org.mockito.Mockito.times;...

On the other hand, when I usepprint(r.git.diff('master').split('\n')) then I get the right result:

...'+import static org.mockito.Matchers.anyLong;','+import static org.mockito.Matchers.anyString;','+import static org.mockito.Mockito.times;',...

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp