summaryrefslogtreecommitdiff
path: root/git/db/cmd/base.py
diff options
context:
space:
mode:
authorMark Nevill <mark@nevill.ch>2011-07-17 21:26:27 +0200
committerSebastian Thiel <byronimo@gmail.com>2011-07-18 17:48:23 +0200
commit6e86f8a8a0638abe2c18ae0bb36cc992b0ababe5 (patch)
treed819d26a2493eb79c426fff91a448c1186702a40 /git/db/cmd/base.py
parenta84856911d05e9877ef46713c1d20bc02482665f (diff)
downloadgitpython-6e86f8a8a0638abe2c18ae0bb36cc992b0ababe5.tar.gz
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
Diffstat (limited to 'git/db/cmd/base.py')
-rw-r--r--git/db/cmd/base.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/git/db/cmd/base.py b/git/db/cmd/base.py
index 6a4a6544..5fa82dc7 100644
--- a/git/db/cmd/base.py
+++ b/git/db/cmd/base.py
@@ -701,6 +701,9 @@ class CmdHighLevelRepository(HighLevelRepository):
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)
@@ -747,8 +750,8 @@ class CmdHighLevelRepository(HighLevelRepository):
m = self.re_tab_full_line.search(line)
text, = m.groups()
blames[-1][0] = c
- blames[-1][1].append( text )
- info = None
+ blames[-1][1].append(text)
+ info = { 'id' : sha }
# END if we collected commit info
# END distinguish filename,summary,rest
# END distinguish author|committer vs filename,summary,rest