Skip to content

Commit

Permalink
Merge pull request #29 from gucong3000/git_blame
Browse files Browse the repository at this point in the history
fix regexp of git blame
  • Loading branch information
gucong3000 authored Mar 29, 2017
2 parents 3537dd4 + c0b24e2 commit ba1c7a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/git-blame.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const BufferStreams = require('bufferstreams');
const spawn = require('child_process').spawn;
const REBLAME = /(?:^|\n)(\w+)(?:\s.+?)?\s+\((?:<(.+?)>|(.+?))\s+((?:@?\d+|\d+\D\d+\D\d+\s\d+\D\d+\D\d+)(?:\s+[+-]\d+)?)\s+(\d+)\)/gm;
const RE_BLAME = /(?:^|\n)\^?(\w+)(?:\s.+?)?\s+\((?:<(.+?)>|(.+?))\s+((?:@?\d+|\d+\D\d+\D\d+\s\d+\D\d+\D\d+)(?:\s+[+-]\d+)?)\s+(\d+)\)/gm;
const parseDate = require('./parse-date');

/**
Expand Down Expand Up @@ -62,9 +62,9 @@ function getReaslt(data) {
const result = [];
let match;
data = data.toString();
REBLAME.lastIndex = 0;
RE_BLAME.lastIndex = 0;

while ((match = REBLAME.exec(data))) {
while ((match = RE_BLAME.exec(data))) {
const lineNumber = +match[5];
const blame = result[lineNumber] = {
hash: match[1],
Expand Down

0 comments on commit ba1c7a2

Please sign in to comment.