From 3554cad19bb272fcccf89a49a7fe36f6bee4913a Mon Sep 17 00:00:00 2001 From: David Disu Date: Fri, 30 Sep 2022 05:21:52 +0100 Subject: [PATCH] Allow fallback to default config --- apps/remix-ide/src/app/files/dgitProvider.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/files/dgitProvider.js b/apps/remix-ide/src/app/files/dgitProvider.js index c49172abe8..d3e60a954e 100644 --- a/apps/remix-ide/src/app/files/dgitProvider.js +++ b/apps/remix-ide/src/app/files/dgitProvider.js @@ -50,6 +50,8 @@ class DGitProvider extends Plugin { async getGitConfig () { const workspace = await this.call('filePanel', 'getCurrentWorkspace') + + if (!workspace) return return { fs: window.remixFileSystemCallback, dir: addSlash(workspace.absolutePath) @@ -152,14 +154,16 @@ class DGitProvider extends Plugin { } async currentbranch (config) { - const cmd = config ? config : await this.getGitConfig() + const defaultConfig = await this.getGitConfig() + const cmd = config ? defaultConfig ? { ...defaultConfig, ...config } : config : defaultConfig const name = await git.currentBranch(cmd) return name } async branches (config) { - const cmd = config ? config : await this.getGitConfig() + const defaultConfig = await this.getGitConfig() + const cmd = config ? defaultConfig ? { ...defaultConfig, ...config } : config : defaultConfig const remotes = await this.remotes(config) let branches = [] branches = (await git.listBranches(cmd)).map((branch) => { return { remote: undefined, name: branch } })