Skip to content

Commit

Permalink
Merge pull request #4236 from ethereum/submodulecommit
Browse files Browse the repository at this point in the history
Submodulecommit
  • Loading branch information
yann300 committed Nov 14, 2023
2 parents d8fa6f6 + 0f26d8d commit ee3b763
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
43 changes: 43 additions & 0 deletions apps/remix-ide/src/app/files/dgitProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -371,6 +413,7 @@ class DGitProvider extends Plugin {
console.log(e)
}
}

setTimeout(async () => {
await this.call('fileManager', 'refresh')
}, 1000)
Expand Down
1 change: 1 addition & 0 deletions apps/remix-ide/src/remixEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

Expand Down

0 comments on commit ee3b763

Please sign in to comment.