浏览代码

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()

正在加载...
取消
保存