Преглед на файлове

Cleans up overloads

main
Eric Amodio преди 2 години
родител
ревизия
3820349af8
променени са 3 файла, в които са добавени 11 реда и са изтрити 36 реда
  1. +6
    -19
      src/env/node/git/localGitProvider.ts
  2. +1
    -13
      src/git/gitProvider.ts
  3. +4
    -4
      src/git/gitProviderService.ts

+ 6
- 19
src/env/node/git/localGitProvider.ts Целия файл

@ -3463,34 +3463,21 @@ export class LocalGitProvider implements GitProvider, Disposable {
}
}
async resolveReference(
repoPath: string,
ref: string,
fileName?: string,
options?: { timeout?: number },
): Promise<string>;
async resolveReference(repoPath: string, ref: string, uri?: Uri, options?: { timeout?: number }): Promise<string>;
@log()
async resolveReference(
repoPath: string,
ref: string,
fileNameOrUri?: string | Uri,
options?: { timeout?: number },
) {
if (ref == null || ref.length === 0 || ref === GitRevision.deletedOrMissing || GitRevision.isUncommitted(ref)) {
async resolveReference(repoPath: string, ref: string, pathOrUri?: string | Uri, options?: { timeout?: number }) {
if (!ref || ref === GitRevision.deletedOrMissing || GitRevision.isUncommitted(ref)) {
return ref;
}
if (fileNameOrUri == null) {
if (pathOrUri == null) {
if (GitRevision.isSha(ref) || !GitRevision.isShaLike(ref) || ref.endsWith('^3')) return ref;
return (await Git.rev_parse__verify(repoPath, ref)) ?? ref;
}
const fileName =
typeof fileNameOrUri === 'string' ? fileNameOrUri : normalizePath(relative(repoPath, fileNameOrUri.fsPath));
const path = typeof pathOrUri === 'string' ? pathOrUri : normalizePath(relative(repoPath, pathOrUri.fsPath));
const blob = await Git.rev_parse__verify(repoPath, ref, fileName);
const blob = await Git.rev_parse__verify(repoPath, ref, path);
if (blob == null) return GitRevision.deletedOrMissing;
let promise: Promise<string | void | undefined> = Git.log__find_object(
@ -3498,7 +3485,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
blob,
ref,
this.container.config.advanced.commitOrdering,
fileName,
path,
);
if (options?.timeout != null) {
promise = Promise.race([promise, Functions.wait(options.timeout)]);

+ 1
- 13
src/git/gitProvider.ts Целия файл

@ -366,19 +366,7 @@ export interface GitProvider {
resolveReference(
repoPath: string,
ref: string,
fileName?: string,
options?: { timeout?: number | undefined },
): Promise<string>;
resolveReference(
repoPath: string,
ref: string,
uri?: Uri,
options?: { timeout?: number | undefined },
): Promise<string>;
resolveReference(
repoPath: string,
ref: string,
fileNameOrUri?: string | Uri,
pathOrUri?: string | Uri,
options?: { timeout?: number | undefined },
): Promise<string>;
validateBranchOrTagName(repoPath: string, ref: string): Promise<boolean>;

+ 4
- 4
src/git/gitProviderService.ts Целия файл

@ -1784,7 +1784,7 @@ export class GitProviderService implements Disposable {
async resolveReference(
repoPath: string,
ref: string,
fileName?: string,
path?: string,
options?: { timeout?: number },
): Promise<string>;
async resolveReference(repoPath: string, ref: string, uri?: Uri, options?: { timeout?: number }): Promise<string>;
@ -1792,15 +1792,15 @@ export class GitProviderService implements Disposable {
async resolveReference(
repoPath: string | Uri,
ref: string,
fileNameOrUri?: string | Uri,
pathOrUri?: string | Uri,
options?: { timeout?: number },
) {
if (ref == null || ref.length === 0 || ref === GitRevision.deletedOrMissing || GitRevision.isUncommitted(ref)) {
if (!ref || ref === GitRevision.deletedOrMissing || GitRevision.isUncommitted(ref)) {
return ref;
}
const { provider, path } = this.getProvider(repoPath);
return provider.resolveReference(path, ref, fileNameOrUri, options);
return provider.resolveReference(path, ref, pathOrUri, options);
}
@log()

Зареждане…
Отказ
Запис