Procházet zdrojové kódy

Fixes parsing issue with certain renamed files

main
Eric Amodio před 5 roky
rodič
revize
66a9e65f4b
1 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. +6
    -2
      src/git/parsers/logParser.ts

+ 6
- 2
src/git/parsers/logParser.ts Zobrazit soubor

@ -14,7 +14,7 @@ const diffRangeRegex = /^@@ -(\d+?),(\d+?) \+(\d+?),(\d+?) @@/;
export const fileStatusRegex = /(\S)\S*\t([^\t\n]+)(?:\t(.+))?/;
const fileStatusAndSummaryRegex = /^(\d+?|-)\s+?(\d+?|-)\s+?(.*)(?:\n\s(delete|rename|create))?/;
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 logFileSimpleRenamedRegex = /^<r> (\S+)\s*(.*)$/s;
@ -272,7 +272,11 @@ export class GitLogParser {
renamedFileName
);
if (renamedMatch != null) {
entry.fileName = `${renamedMatch[1]}${renamedMatch[3]}${renamedMatch[4]}`;
// If there is no new path, the path part was removed so ensure we don't end up with //
entry.fileName =
renamedMatch[3] === ''
? `${renamedMatch[1]}${renamedMatch[4]}`.replace('//', '/')
: `${renamedMatch[1]}${renamedMatch[3]}${renamedMatch[4]}`;
entry.originalFileName = `${renamedMatch[1]}${renamedMatch[2]}${renamedMatch[4]}`;
}
else {

Načítá se…
Zrušit
Uložit