summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2011-07-18 17:36:51 +0200
committerSebastian Thiel <byronimo@gmail.com>2011-07-18 17:36:51 +0200
commit8e3883a0691ce1957996c5b37d7440ab925c731e (patch)
tree32a88e8ab218024716dacd6834da7d4b0a460870 /git
parentd6d544f67a1f3572781271b5f3030d97e6c6d9e2 (diff)
parent55885e0c4fc40dd2780ff2cde9cda81a43e682c9 (diff)
downloadgitpython-8e3883a0691ce1957996c5b37d7440ab925c731e.tar.gz
Merge branch 'blamefix' into 0.3
Diffstat (limited to 'git')
-rw-r--r--git/repo/base.py7
-rw-r--r--git/test/test_repo.py9
2 files changed, 14 insertions, 2 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index 14efabdc..20c96b22 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -570,11 +570,14 @@ class Repo(object):
if self.re_hexsha_only.search(firstpart):
# handles
# 634396b2f541a9f2d58b00be1a07f0c358b999b3 1 1 7 - indicates blame-data start
- # 634396b2f541a9f2d58b00be1a07f0c358b999b3 2 2
+ # 634396b2f541a9f2d58b00be1a07f0c358b999b3 2 2 - indicates another line of blame with the same data
digits = parts[-1].split(" ")
if len(digits) == 3:
info = {'id': firstpart}
blames.append([None, []])
+ elif info['id'] != firstpart:
+ info = {'id': firstpart}
+ blames.append([commits.get(firstpart), []])
# END blame data initialization
else:
m = self.re_author_committer_start.search(firstpart)
@@ -622,7 +625,7 @@ class Repo(object):
text, = m.groups()
blames[-1][0] = c
blames[-1][1].append( text )
- info = None
+ info = {'id': sha}
# END if we collected commit info
# END distinguish filename,summary,rest
# END distinguish author|committer vs filename,summary,rest
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index 00ae37db..21abb86a 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -269,6 +269,15 @@ class TestRepo(TestBase):
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 b
+
def test_untracked_files(self):
base = self.rorepo.working_tree_dir
files = ( join_path_native(base, "__test_myfile"),