diff --git a/apps/remix-ide/src/app/files/dgitProvider.js b/apps/remix-ide/src/app/files/dgitProvider.js index 921e579c75..6738c52ddf 100644 --- a/apps/remix-ide/src/app/files/dgitProvider.js +++ b/apps/remix-ide/src/app/files/dgitProvider.js @@ -362,6 +362,48 @@ class DGitProvider extends Plugin { this.call('terminal', 'logHtml', `Cloning submodule ${dir}...`) await git.clone(cmd) this.call('terminal', 'logHtml', `Cloned successfully submodule ${dir}...`) + + const commitHash = await git.resolveRef({ + ...await this.getGitConfig(currentDir), + ref: 'HEAD' + }) + + const result = await git.walk({ + ...await this.getGitConfig(currentDir), + trees: [git.TREE({ ref: commitHash })], + map: async function (filepath, [A]) { + if(filepath === module.path) { + return await A.oid() + } + } + }) + if(result && result.length) { + this.call('terminal', 'logHtml', `Checking out submodule ${dir} to ${result[0]} in directory ${dir}`) + await git.fetch({ + ...await this.parseInput(input), + ...await this.getGitConfig(dir), + singleBranch: true, + ref: result[0] + }) + + await git.checkout({ + ...await this.getGitConfig(dir), + ref: result[0] + }) + + const log = await git.log({ + ...await this.getGitConfig(dir), + }) + + if(log[0].oid !== result[0]) { + this.call('terminal', 'log', { + type: 'error', + value: `Could not checkout submodule to ${result[0]}` + })} else { + this.call('terminal', 'logHtml',`Checked out submodule ${dir} to ${result[0]}`) + } + } + await this.updateSubmodules({ ...input, dir @@ -371,6 +413,7 @@ class DGitProvider extends Plugin { console.log(e) } } + setTimeout(async () => { await this.call('fileManager', 'refresh') }, 1000) diff --git a/apps/remix-ide/src/remixEngine.js b/apps/remix-ide/src/remixEngine.js index 4c2b708bfe..46baa7f6c9 100644 --- a/apps/remix-ide/src/remixEngine.js +++ b/apps/remix-ide/src/remixEngine.js @@ -21,6 +21,7 @@ export class RemixEngine extends Engine { if (name === 'walletconnect') return { queueTimeout: 60000 * 4 } if (name === 'udapp') return { queueTimeout: 60000 * 4 } if (name === 'circuit-compiler') return { queueTimeout: 60000 * 4 } + if (name === 'filePanel') return { queueTimeout: 60000 * 20 } return { queueTimeout: 10000 } }