From 2ff3a3e72b1ff79e75777ccdddc86f8540ce833d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 17 Jul 2016 10:31:53 +0200 Subject: fix(blame): lazily fetch full commit message That way, we will not only get the summary line contained in the blame, but fetch the full message. This is more costly than the previous implementation allowed it to be, but being less surprising/correct certainly is the preferred behaviour here. Fixes #485 --- git/test/test_repo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/test') diff --git a/git/test/test_repo.py b/git/test/test_repo.py index fc8125fa..87887bad 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -307,7 +307,7 @@ class TestRepo(TestBase): assert_equal('Tom Preston-Werner', c.committer.name) assert_equal('tom@mojombo.com', c.committer.email) assert_equal(1191997100, c.committed_date) - assert_equal('initial grit setup', c.message) + self.assertRaisesRegexp(ValueError, "634396b2f541a9f2d58b00be1a07f0c358b999b3 missing", lambda: c.message) # test the 'lines per commit' entries tlist = b[0][1] -- cgit v1.2.3 From 4006c4347788a078051dffd6b197bb0f19d50b86 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 23 Jul 2016 16:38:59 +0200 Subject: 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 --- git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color | 1 + git/test/test_diff.py | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color (limited to 'git/test') diff --git a/git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color b/git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color new file mode 100644 index 00000000..dad85c68 --- /dev/null +++ b/git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color @@ -0,0 +1 @@ +:100644 100644 739bc65220ad90e9ebfa2d6af1723b97555569a4 0000000000000000000000000000000000000000 M README.md 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')): -- cgit v1.2.3