From da8f3a1d04248b6db522761d370eef1db2c616bc Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 13 Sep 2023 19:16:03 -0400 Subject: [PATCH] Fixes restore of the Commit Details on load --- src/git/gitProviderService.ts | 25 +++++++++++++++++++++- src/webviews/commitDetails/commitDetailsWebview.ts | 4 +++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index e1ee276..95e6328 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -2358,13 +2358,36 @@ export class GitProviderService implements Disposable { ); } + getOrOpenRepository( + uri: Uri, + options?: { closeOnOpen?: boolean; detectNested?: boolean; force?: boolean }, + ): Promise; + getOrOpenRepository( + path: string, + options?: { closeOnOpen?: boolean; detectNested?: boolean; force?: boolean }, + ): Promise; + getOrOpenRepository( + pathOrUri: string | Uri, + options?: { closeOnOpen?: boolean; detectNested?: boolean; force?: boolean }, + ): Promise; @log({ exit: true }) async getOrOpenRepository( - uri: Uri, + pathOrUri?: string | Uri, options?: { closeOnOpen?: boolean; detectNested?: boolean; force?: boolean }, ): Promise { + if (pathOrUri == null) return undefined; + const scope = getLogScope(); + let uri: Uri; + if (typeof pathOrUri === 'string') { + if (!pathOrUri) return undefined; + + uri = this.getAbsoluteUri(pathOrUri); + } else { + uri = pathOrUri; + } + const path = getBestPath(uri); let repository: Repository | undefined; repository = this.getRepository(uri); diff --git a/src/webviews/commitDetails/commitDetailsWebview.ts b/src/webviews/commitDetails/commitDetailsWebview.ts index 425cd6c..1b6fd48 100644 --- a/src/webviews/commitDetails/commitDetailsWebview.ts +++ b/src/webviews/commitDetails/commitDetailsWebview.ts @@ -574,7 +574,8 @@ export class CommitDetailsWebviewProvider implements WebviewProvider { @@ -584,6 +585,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider