diff options
-rw-r--r-- | git/test/fixtures/diff_patch_binary | 3 | ||||
-rw-r--r-- | git/test/fixtures/diff_raw_binary | 1 | ||||
-rw-r--r-- | git/test/test_diff.py | 10 |
3 files changed, 14 insertions, 0 deletions
diff --git a/git/test/fixtures/diff_patch_binary b/git/test/fixtures/diff_patch_binary new file mode 100644 index 00000000..c92ccd6e --- /dev/null +++ b/git/test/fixtures/diff_patch_binary @@ -0,0 +1,3 @@ +diff --git a/rps b/rps +index f4567df37451b230b1381b1bc9c2bcad76e08a3c..736bd596a36924d30b480942e9475ce0d734fa0d 100755 +Binary files a/rps and b/rps differ diff --git a/git/test/fixtures/diff_raw_binary b/git/test/fixtures/diff_raw_binary new file mode 100644 index 00000000..d4673fa4 --- /dev/null +++ b/git/test/fixtures/diff_raw_binary @@ -0,0 +1 @@ +:100755 100755 f4567df37451b230b1381b1bc9c2bcad76e08a3c 736bd596a36924d30b480942e9475ce0d734fa0d M rps diff --git a/git/test/test_diff.py b/git/test/test_diff.py index ce0f64f2..ebf9527a 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -65,6 +65,16 @@ class TestDiff(TestBase): assert diff.rename_to == 'that' assert len(list(diffs.iter_change_type('R'))) == 1 + 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')): + res = method(None, StringProcessAdapter(fixture(file_name)).stdout) + assert len(res) == 1 + assert len(list(res.iter_change_type('M'))) == 1 + if res[0].diff: + assert res[0].diff == "Binary files a/rps and b/rps differ\n", "in patch mode, we get a diff text" + # end for each method to test + def test_diff_patch_format(self): # test all of the 'old' format diffs for completness - it should at least # be able to deal with it |