From d69b488923da6922832bc635a1894766cb73abe0 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 25 Nov 2019 00:04:22 -0500 Subject: [PATCH] Reverts (most of) eda2cd3 (range issues) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was a bad fix -- the issue wasn't special characters at all 😖 --- src/git/git.ts | 17 ++++++++++------- src/git/models/models.ts | 21 --------------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/git/git.ts b/src/git/git.ts index fa61502..d0b2ddb 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -6,12 +6,11 @@ import * as iconv from 'iconv-lite'; import { GlyphChars } from '../constants'; import { Container } from '../container'; import { Logger } from '../logger'; -import { Iterables, Objects, Strings } from '../system'; +import { Objects, Strings } from '../system'; import { findGitPath, GitLocation } from './locator'; import { run, RunOptions } from './shell'; import { GitBranchParser, GitLogParser, GitReflogParser, GitStashParser, GitTagParser } from './parsers/parsers'; import { GitFileStatus } from './models/file'; -import { GitRevision } from './models/models'; export * from './models/models'; export * from './parsers/parsers'; @@ -119,6 +118,10 @@ export async function git(options: GitCommandOptio ...(configs !== undefined ? configs : emptyArray) ); + if (process.platform === 'win32') { + args.splice(0, 0, '-c', 'core.longpaths=true'); + } + promise = run(gitInfo.path, args, encoding, runOpts); pendingCommands.set(command, promise); @@ -618,10 +621,10 @@ export namespace Git { params.push(`--diff-filter=${filter}`); } if (ref1) { - params.push(...GitRevision.toParams(ref1)); + params.push(ref1); } if (ref2) { - params.push(...GitRevision.toParams(ref2)); + params.push(ref2); } return git({ cwd: repoPath, configs: ['-c', 'color.diff=false'] }, ...params, '--'); @@ -630,7 +633,7 @@ export namespace Git { export function diff__shortstat(repoPath: string, ref?: string) { const params = ['diff', '--shortstat', '--no-ext-diff']; if (ref) { - params.push(...GitRevision.toParams(ref)); + params.push(ref); } return git({ cwd: repoPath, configs: ['-c', 'color.diff=false'] }, ...params, '--'); @@ -730,7 +733,7 @@ export namespace Git { if (reverse) { params.push('--reverse', '--ancestry-path', `${ref}..HEAD`); } else { - params.push(...GitRevision.toParams(ref)); + params.push(ref); } } @@ -974,7 +977,7 @@ export namespace Git { if (options.count) { params.push('--count'); } - params.push(...Iterables.flatMap(refs, r => GitRevision.toParams(r))); + params.push(...refs); const data = await git({ cwd: repoPath, errors: GitErrorHandling.Ignore }, 'rev-list', ...params, '--'); return data.length === 0 ? undefined : Number(data.trim()) || undefined; diff --git a/src/git/models/models.ts b/src/git/models/models.ts index 49daa0a..37e7891 100644 --- a/src/git/models/models.ts +++ b/src/git/models/models.ts @@ -1,8 +1,6 @@ 'use strict'; import { Git } from '../git'; -const revisionRangeRegex = /([^.]*)(\.\.\.?)([^.]*)/; - export namespace GitRevision { export function createRange( ref1: string | undefined, @@ -11,25 +9,6 @@ export namespace GitRevision { ): string { return `${ref1 || ''}${notation}${ref2 || ''}`; } - - export function toParams(ref: string | undefined) { - if (ref == null || ref.length === 0) return []; - - const match = revisionRangeRegex.exec(ref); - if (match == null) return [ref]; - - const [, ref1, notation, ref2] = match; - - const range = []; - if (ref1) { - range.push(ref1); - } - range.push(notation); - if (ref2) { - range.push(ref2); - } - return range; - } } export interface GitReference {