Allow fallback to default config

pull/2879/head
David Disu 2 years ago
parent 74e0505070
commit 3554cad19b
  1. 8
      apps/remix-ide/src/app/files/dgitProvider.js

@ -50,6 +50,8 @@ class DGitProvider extends Plugin {
async getGitConfig () { async getGitConfig () {
const workspace = await this.call('filePanel', 'getCurrentWorkspace') const workspace = await this.call('filePanel', 'getCurrentWorkspace')
if (!workspace) return
return { return {
fs: window.remixFileSystemCallback, fs: window.remixFileSystemCallback,
dir: addSlash(workspace.absolutePath) dir: addSlash(workspace.absolutePath)
@ -152,14 +154,16 @@ class DGitProvider extends Plugin {
} }
async currentbranch (config) { 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) const name = await git.currentBranch(cmd)
return name return name
} }
async branches (config) { 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) const remotes = await this.remotes(config)
let branches = [] let branches = []
branches = (await git.listBranches(cmd)).map((branch) => { return { remote: undefined, name: branch } }) branches = (await git.listBranches(cmd)).map((branch) => { return { remote: undefined, name: branch } })

Loading…
Cancel
Save