From 6e86f8a8a0638abe2c18ae0bb36cc992b0ababe5 Mon Sep 17 00:00:00 2001 From: Mark Nevill Date: Sun, 17 Jul 2011 21:26:27 +0200 Subject: Fixed consecutive lines with same blame info not appearing in blame. This fixes a bug when parsing blame -p output: Full commit info headers only appear for the first line from a particular commit, but other lines were ignored as the blame info dict was reset after each line. This patch handles both multiple consecutive lines from a commit and interleaved lines from multiple commits. Added real test to verify blame works against the actual commit, not only a mock of what was produced by blame in old git releases --- git/test/db/base.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'git/test/db/base.py') diff --git a/git/test/db/base.py b/git/test/db/base.py index 2f8f50e2..0f5eebe4 100644 --- a/git/test/db/base.py +++ b/git/test/db/base.py @@ -283,6 +283,15 @@ class RepoBase(TestDBBase): assert_true( isinstance( tlist[0], basestring ) ) assert_true( len( tlist ) < sum( len(t) for t in tlist ) ) # test for single-char bug + def test_blame_real(self): + c = 0 + for item in self.rorepo.head.commit.tree.traverse( + predicate=lambda i, d: i.type == 'blob' and i.path.endswith('.py')): + c += 1 + b = self.rorepo.blame(self.rorepo.head, item.path) + #END for each item to traverse + assert c + def test_untracked_files(self): base = self.rorepo.working_tree_dir files = ( join_path_native(base, "__test_myfile"), -- cgit v1.2.1