Skip to content

Assertion Error when "diffing" index during cherry pick conflict. #323

Closed
@Agecaf

Description

@Agecaf

I am trying to use gitpython to make a tool for helping in cherry-picking. The "repo.git.cherry_pick('hexsha')" command works perfectly, but, when I want to check the files with conflicts via

repo.index.diff(None)

I get the following Assertion Error;

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\git\index\util.py", line 69, in check_default_index
    return func(self, *args, **kwargs)
  File "C:\Python27\lib\site-packages\git\index\base.py", line 1197, in diff
    return super(IndexFile, self).diff(other, paths, create_patch, **kwargs)
  File "C:\Python27\lib\site-packages\git\diff.py", line 109, in diff
    index = diff_method(self.repo, proc.stdout)
  File "C:\Python27\lib\site-packages\git\diff.py", line 391, in _index_from_raw_format
    new_file, deleted_file, rename_from, rename_to, '')
  File "C:\Python27\lib\site-packages\git\diff.py", line 226, in __init__
    assert self.a_mode
AssertionError

Similarly, when comparing with head,

repo.index.diff('HEAD')

I get a slightly different error (a_mode -> b_mode);

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\git\index\util.py", line 69, in check_default_index
    return func(self, *args, **kwargs)
  File "C:\Python27\lib\site-packages\git\index\base.py", line 1189, in diff
    return other.diff(self.Index, paths, create_patch, **kwargs)
  File "C:\Python27\lib\site-packages\git\diff.py", line 109, in diff
    index = diff_method(self.repo, proc.stdout)
  File "C:\Python27\lib\site-packages\git\diff.py", line 391, in _index_from_raw_format
    new_file, deleted_file, rename_from, rename_to, '')
  File "C:\Python27\lib\site-packages\git\diff.py", line 231, in __init__
    assert self.b_mode
AssertionError

I'll be using the items with status non 0 in the index as a workaround for now (there are three per item with conflict).

Just for completeness, "diffing" works perfectly fine when not in cherry-picking conflict resolution (I tested it in the same session as the one that produced the errors).

Regards,
Agecaf

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions