pull/5370/head
filip mertens 2 years ago committed by Aniket
parent f73838a0a9
commit e3fd66f8b8
  1. 38
      apps/remix-ide/src/app/files/dgitProvider.js

@ -158,25 +158,33 @@ class DGitProvider extends Plugin {
} }
async currentbranch (config) { async currentbranch (config) {
const defaultConfig = await this.getGitConfig() try{
const cmd = config ? defaultConfig ? { ...defaultConfig, ...config } : config : defaultConfig const defaultConfig = await this.getGitConfig()
const name = await git.currentBranch(cmd) const cmd = config ? defaultConfig ? { ...defaultConfig, ...config } : config : defaultConfig
const name = await git.currentBranch(cmd)
return name return name
}catch(e){
return ''
}
} }
async branches (config) { async branches (config) {
const defaultConfig = await this.getGitConfig() try{
const cmd = config ? defaultConfig ? { ...defaultConfig, ...config } : config : defaultConfig const defaultConfig = await this.getGitConfig()
const remotes = await this.remotes(config) const cmd = config ? defaultConfig ? { ...defaultConfig, ...config } : config : defaultConfig
let branches = [] const remotes = await this.remotes(config)
branches = (await git.listBranches(cmd)).map((branch) => { return { remote: undefined, name: branch } }) let branches = []
for (const remote of remotes) { branches = (await git.listBranches(cmd)).map((branch) => { return { remote: undefined, name: branch } })
cmd.remote = remote.remote for (const remote of remotes) {
const remotebranches = (await git.listBranches(cmd)).map((branch) => { return { remote: remote.remote, name: branch } }) cmd.remote = remote.remote
branches = [...branches, ...remotebranches] const remotebranches = (await git.listBranches(cmd)).map((branch) => { return { remote: remote.remote, name: branch } })
} branches = [...branches, ...remotebranches]
return branches }
return branches
}catch(e){
return []
}
} }
async commit (cmd) { async commit (cmd) {

Loading…
Cancel
Save