fix git clone

pull/5370/head
filip mertens 11 months ago
parent 2577836b40
commit ee78f93d7c
  1. 8
      apps/remix-ide/src/app/files/dgitProvider.ts
  2. 9
      apps/remixdesktop/src/plugins/isoGitPlugin.ts

@ -425,9 +425,17 @@ class DGitProvider extends Plugin {
dir: folder, dir: folder,
input input
} }
this.call('terminal', 'logHtml', `Cloning ${input.url}... please wait...`)
try{
const result = await this.call('isogit', 'clone', cmd) const result = await this.call('isogit', 'clone', cmd)
this.call('fs', 'openWindow', folder) this.call('fs', 'openWindow', folder)
return result return result
}catch(e){
this.call('notification', 'alert', {
id: 'dgitAlert',
message: 'Unexpected error while cloning the repository: \n' + e.toString(),
})
}
} else { } else {
const permission = await this.askUserPermission('clone', 'Import multiple files into your workspaces.') const permission = await this.askUserPermission('clone', 'Import multiple files into your workspaces.')
if (!permission) return false if (!permission) return false

@ -54,11 +54,12 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
gitIsInstalled: boolean = false gitIsInstalled: boolean = false
constructor(webContentsId: number, profile: Profile) { constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile) super(webContentsId, profile)
this.onload(() => { this.onload(async () => {
this.on('fs' as any, 'workingDirChanged', async (path: string) => { this.on('fs' as any, 'workingDirChanged', async (path: string) => {
this.workingDir = path this.workingDir = path
this.gitIsInstalled = await gitProxy.version() ? true : false this.gitIsInstalled = await gitProxy.version() ? true : false
}) })
this.gitIsInstalled = await gitProxy.version() ? true : false
}) })
} }
@ -274,9 +275,13 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
async clone(cmd: any) { async clone(cmd: any) {
if (this.gitIsInstalled) { if (this.gitIsInstalled) {
try{
await gitProxy.clone(cmd.url, cmd.dir) await gitProxy.clone(cmd.url, cmd.dir)
}catch(e){
throw e
}
} else { } else {
try { try {
const clone = await git.clone({ const clone = await git.clone({

Loading…
Cancel
Save