From 987f9bbd08446de3f9d135659f2e36ad6c9d14fb Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 8 Jan 2015 11:13:41 +0100 Subject: Added support for rename detection in raw mode (which is the default). Fixes #36 --- git/test/fixtures/diff_rename_raw | 1 + git/test/test_diff.py | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 git/test/fixtures/diff_rename_raw (limited to 'git/test') diff --git a/git/test/fixtures/diff_rename_raw b/git/test/fixtures/diff_rename_raw new file mode 100644 index 00000000..92d06d22 --- /dev/null +++ b/git/test/fixtures/diff_rename_raw @@ -0,0 +1 @@ +:100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 R100 this that diff --git a/git/test/test_diff.py b/git/test/test_diff.py index c5183089..ce0f64f2 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -56,6 +56,15 @@ class TestDiff(TestBase): assert_equal(diff.rename_from, 'AUTHORS') assert_equal(diff.rename_to, 'CONTRIBUTORS') + output = StringProcessAdapter(fixture('diff_rename_raw')) + diffs = Diff._index_from_raw_format(self.rorepo, output.stdout) + assert len(diffs) == 1 + diff = diffs[0] + assert diff.renamed + assert diff.rename_from == 'this' + assert diff.rename_to == 'that' + assert len(list(diffs.iter_change_type('R'))) == 1 + 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 -- cgit v1.2.1