Skip to content

iter_change_type can't get the "M" type #493

Closed
@alexazhou

Description

@alexazhou

I have modify a file, use command "git status" can see it. but i can't use the iter_change_type of GitPython to find it out.

AlexaZhou$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   LICENSE

AlexaZhou$
AlexaZhou$

I can see it in the diff list, but can't get it from iter_change_type.

>>> repo = git.Repo('./')
>>> diff = repo.index.diff(None)
>>> 
>>> list( diff )
[<git.diff.Diff object at 0x1030ad348>]
>>> 
>>> list(diff.iter_change_type('A'))
[]
>>> list(diff.iter_change_type('D'))
[]
>>> list(diff.iter_change_type('R'))
[]
>>> list(diff.iter_change_type('M'))
[]
>>> 
>>> tmp = diff[0]
>>> tmp.a_blob
<git.Blob "65c5ca88a67c30becee01c5a8816d964b03862f9">
>>> 
>>> tmp.b_blob
>>> 
>>> tmp.b_blob == None
True
>>> 
>>> 

when I use GitPython 1.0.1 it seems work right. But i can't work after i upgrede to GitPython 2.0.7

Help you can fix it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions