|
@ -19,7 +19,7 @@ const diffRangeRegex = /^@@ -(\d+?),(\d+?) \+(\d+?),(\d+?) @@/; |
|
|
export const fileStatusRegex = /(\S)\S*\t([^\t\n]+)(?:\t(.+))?/; |
|
|
export const fileStatusRegex = /(\S)\S*\t([^\t\n]+)(?:\t(.+))?/; |
|
|
const fileStatusAndSummaryRegex = /^(\d+?|-)\s+?(\d+?|-)\s+?(.*)(?:\n\s(delete|rename|copy|create))?/; |
|
|
const fileStatusAndSummaryRegex = /^(\d+?|-)\s+?(\d+?|-)\s+?(.*)(?:\n\s(delete|rename|copy|create))?/; |
|
|
const fileStatusAndSummaryRenamedFileRegex = /(.+)\s=>\s(.+)/; |
|
|
const fileStatusAndSummaryRenamedFileRegex = /(.+)\s=>\s(.+)/; |
|
|
const fileStatusAndSummaryRenamedFilePathRegex = /(.*?){(.+?)\s=>\s(.*?)}(.*)/; |
|
|
|
|
|
|
|
|
const fileStatusAndSummaryRenamedFilePathRegex = /(.*?){(.+?)?\s=>\s(.*?)?}(.*)/; |
|
|
|
|
|
|
|
|
const logFileSimpleRegex = /^<r> (.*)\s*(?:(?:diff --git a\/(.*) b\/(.*))|(?:(\S)\S*\t([^\t\n]+)(?:\t(.+))?))/gm; |
|
|
const logFileSimpleRegex = /^<r> (.*)\s*(?:(?:diff --git a\/(.*) b\/(.*))|(?:(\S)\S*\t([^\t\n]+)(?:\t(.+))?))/gm; |
|
|
const logFileSimpleRenamedRegex = /^<r> (\S+)\s*(.*)$/s; |
|
|
const logFileSimpleRenamedRegex = /^<r> (\S+)\s*(.*)$/s; |
|
@ -656,12 +656,27 @@ export class GitLogParser { |
|
|
renamedMatch = |
|
|
renamedMatch = |
|
|
fileStatusAndSummaryRenamedFilePathRegex.exec(renamedFileName); |
|
|
fileStatusAndSummaryRenamedFilePathRegex.exec(renamedFileName); |
|
|
if (renamedMatch != null) { |
|
|
if (renamedMatch != null) { |
|
|
|
|
|
const [, start, from, to, end] = renamedMatch; |
|
|
// If there is no new path, the path part was removed so ensure we don't end up with //
|
|
|
// If there is no new path, the path part was removed so ensure we don't end up with //
|
|
|
entry.path = |
|
|
|
|
|
renamedMatch[3] === '' |
|
|
|
|
|
? `${renamedMatch[1]}${renamedMatch[4]}`.replace('//', '/') |
|
|
|
|
|
: `${renamedMatch[1]}${renamedMatch[3]}${renamedMatch[4]}`; |
|
|
|
|
|
entry.originalPath = `${renamedMatch[1]}${renamedMatch[2]}${renamedMatch[4]}`; |
|
|
|
|
|
|
|
|
if (!to) { |
|
|
|
|
|
entry.path = `${ |
|
|
|
|
|
start.endsWith('/') && end.startsWith('/') |
|
|
|
|
|
? start.slice(0, -1) |
|
|
|
|
|
: start |
|
|
|
|
|
}${end}`;
|
|
|
|
|
|
} else { |
|
|
|
|
|
entry.path = `${start}${to}${end}`; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!from) { |
|
|
|
|
|
entry.originalPath = `${ |
|
|
|
|
|
start.endsWith('/') && end.startsWith('/') |
|
|
|
|
|
? start.slice(0, -1) |
|
|
|
|
|
: start |
|
|
|
|
|
}${end}`;
|
|
|
|
|
|
} else { |
|
|
|
|
|
entry.originalPath = `${start}${from}${end}`; |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
renamedMatch = |
|
|
renamedMatch = |
|
|
fileStatusAndSummaryRenamedFileRegex.exec(renamedFileName); |
|
|
fileStatusAndSummaryRenamedFileRegex.exec(renamedFileName); |
|
|