File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -91,18 +91,14 @@ function markIfNoCommit(parsedBlame) {
91
91
* @param {string } blameOutput - output from 'git blame --porcelain <file>'
92
92
*/
93
93
function parseBlameOutput ( blameOut ) {
94
- // Matches the info lines for a specific line in the blame --porcelain output,
95
- // which is up to the line after the one that begins with filename.
96
- var blameChunkRegex = / (?: .* \n ) * ?f i l e n a m e .* ?\n \t .* ?\n / g;
94
+ // Matches new lines only when followed by a line with commit hash info that
95
+ // are followed by autor line. This is the 1st and 2nd line of the blame
96
+ // --porcelain output.
97
+ var singleLineDataSplitRegex = / \n (? = \w + \s (?: \d + \s ) + \d + \n a u t h o r ) / g;
97
98
98
99
// Split the blame output into data for each line and parse out desired
99
100
// data from each into an object.
100
- var results = [ ] ;
101
- var match ;
102
- while ( ( match = blameChunkRegex . exec ( blameOut ) ) ) {
103
- results . push ( parseBlameLine ( match [ 0 ] ) ) ;
104
- }
105
- return results ;
101
+ return blameOut . split ( singleLineDataSplitRegex ) . map ( parseBlameLine ) ;
106
102
}
107
103
108
104
// EXPORTS
You can’t perform that action at this time.
0 commit comments