Ver a proveniência

Fixes issue w/ parsing some log renames

main
Eric Amodio há 1 ano
ascendente
cometimento
5aa1e48730
2 ficheiros alterados com 22 adições e 6 eliminações
  1. +1
    -0
      CHANGELOG.md
  2. +21
    -6
      src/git/parsers/logParser.ts

+ 1
- 0
CHANGELOG.md Ver ficheiro

@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixes an issue with deep links sometimes failing to properly resolve when a matching repository without the remote is found
- Fixes an issue in the _Commit Graph_ where commits not in the history of a merge commit were showing in the same column
- Fixes `Reset Stored AI Key` command to work for the current provider
- Fixes an issue with parsing some renames in log output
## [14.3.0] - 2023-09-07

+ 21
- 6
src/git/parsers/logParser.ts Ver ficheiro

@ -19,7 +19,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|copy|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;
@ -656,12 +656,27 @@ export class GitLogParser {
renamedMatch =
fileStatusAndSummaryRenamedFilePathRegex.exec(renamedFileName);
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 //
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 {
renamedMatch =
fileStatusAndSummaryRenamedFileRegex.exec(renamedFileName);

Carregando…
Cancelar
Guardar