summaryrefslogtreecommitdiff
path: root/git/test/test_diff.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2016-07-23 16:38:59 +0200
committerSebastian Thiel <byronimo@gmail.com>2016-07-23 16:45:40 +0200
commit4006c4347788a078051dffd6b197bb0f19d50b86 (patch)
treef3891d8874ac9e20f0800c4d5f995579d2a8ccb4 /git/test/test_diff.py
parent1ec4389bc3d1653af301e93fe0a6b25a31da9f3d (diff)
downloadgitpython-4006c4347788a078051dffd6b197bb0f19d50b86.tar.gz
fix(diff): use explicit change-type if possible
That way, we do not have to figure the change type out by examining the diff object. It's implemented in a way that should yield more desireable results as we keep the change-type that git is providing us with. Fixes #493
Diffstat (limited to 'git/test/test_diff.py')
-rw-r--r--git/test/test_diff.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/git/test/test_diff.py b/git/test/test_diff.py
index ba0d2d13..9fdb26a2 100644
--- a/git/test/test_diff.py
+++ b/git/test/test_diff.py
@@ -104,6 +104,15 @@ class TestDiff(TestBase):
assert diff.rename_to == 'that'
assert len(list(diffs.iter_change_type('R'))) == 1
+ def test_diff_of_modified_files_not_added_to_the_index(self):
+ output = StringProcessAdapter(fixture('diff_abbrev-40_full-index_M_raw_no-color'))
+ diffs = Diff._index_from_raw_format(self.rorepo, output.stdout)
+
+ assert len(diffs) == 1, 'one modification'
+ assert len(list(diffs.iter_change_type('M'))) == 1, 'one modification'
+ assert diffs[0].change_type == 'M'
+ assert diffs[0].b_blob is None
+
def test_binary_diff(self):
for method, file_name in ((Diff._index_from_patch_format, 'diff_patch_binary'),
(Diff._index_from_raw_format, 'diff_raw_binary')):