@@ -100,15 +100,24 @@ def construct_blame(file = '', opts = {})
100
100
commit = new_commit [ 0 ]
101
101
102
102
line_num = line . sub ( /^[a-f0-9]{40} [0-9]+ / , '' )
103
- line_num = line_num . sub ( /\s [0-9]+.*$/ , '' ) if line_num . match ( /\s / )
103
+
104
+ if line_num . match ( /\s [0-9]+/ )
105
+ block_length = line_num . sub ( /^[0-9]+\s / , '' ) . sub ( /\s .*$/ , '' )
106
+
107
+ line_num = line_num . sub ( /\s [0-9]+.*$/ , '' )
108
+ else
109
+ block_length = 1
110
+ end
104
111
105
112
# this looks odd, but it's correct... we're initializing this commit's hash, which
106
113
# should contain a :hash -> <sha hash> element, among other things, and the hash
107
114
# OF commit hashes is indexed on the sha hash, so... yeah :)
108
115
#
109
116
commits [ commit ] = { :commit => commit } if ! commits [ commit ]
110
117
111
- parsed_lines [ line_num ] = commit
118
+ for i in line_num . to_i ..( line_num . to_i + block_length . to_i - 1 )
119
+ parsed_lines [ i ] = commit
120
+ end
112
121
end
113
122
114
123
if /^author\s / . match ( line )
@@ -134,8 +143,8 @@ def construct_blame(file = '', opts = {})
134
143
135
144
parsed_lines . each do |line , commit |
136
145
commits [ commit ] [ :line ] = line
137
-
138
- @lines [ line . to_i ] = BlameLine . new ( line . to_i , commits [ commit ] )
146
+ puts 'line ' + line . to_s + ' added to @lines of Blame'
147
+ @lines [ line ] = BlameLine . new ( line , commits [ commit ] )
139
148
end
140
149
end
141
150
0 commit comments