rdesktop2
filip mertens 1 year ago
parent 870083ff49
commit 1a76ab87ba
  1. 23
      apps/remixdesktop/src/plugins/isoGitPlugin.ts
  2. 15
      apps/remixdesktop/src/tools/git.ts

@ -214,19 +214,30 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
async push(cmd: any) { async push(cmd: any) {
console.log('PUSH', cmd)
if (this.gitIsInstalled) {
await gitProxy.push(this.workingDir, cmd.remote, cmd.ref, cmd.remoteRef, cmd.force)
} else {
const push = await git.push({ const push = await git.push({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd, ...cmd,
...parseInput(cmd.input) ...parseInput(cmd.input)
}) })
return push return push
} }
}
async pull(cmd: any) { async pull(cmd: any) {
if (this.gitIsInstalled) {
await gitProxy.pull(this.workingDir, cmd.remote, cmd.ref, cmd.remoteRef)
} else {
const pull = await git.pull({ const pull = await git.pull({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd, ...cmd,
@ -234,10 +245,17 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
}) })
return pull return pull
}
} }
async fetch(cmd: any) { async fetch(cmd: any) {
if (this.gitIsInstalled) {
await gitProxy.fetch(this.workingDir, cmd.remote, cmd.remoteRef)
} else {
const fetch = await git.fetch({ const fetch = await git.fetch({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd, ...cmd,
@ -246,6 +264,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
return fetch return fetch
} }
}
async clone(cmd: any) { async clone(cmd: any) {

@ -41,10 +41,21 @@ export const gitProxy = {
clone: async (url: string, path: string) => { clone: async (url: string, path: string) => {
const { stdout, stderr } = await execAsync(`git clone ${url} ${path}`); const { stdout, stderr } = await execAsync(`git clone ${url} ${path}`);
console.log('stdout:', stdout);
console.log('stderr:', stderr);
}, },
async push(path: string, remote: string, src: string, branch: string, force: boolean = false) {
const { stdout, stderr } = await execAsync(`git push ${force? ' -f':'' } ${remote} ${src}:${branch}`, { cwd: path });
},
async pull(path: string, remote: string, src: string, branch: string) {
const { stdout, stderr } = await execAsync(`git pull ${remote} ${src}:${branch}`, { cwd: path });
},
async fetch(path: string, remote: string, branch: string) {
const { stdout, stderr } = await execAsync(`git fetch ${remote} ${branch}`, { cwd: path });
},
status: async (path: string) => { status: async (path: string) => {
const result = await execAsync('git status --porcelain -uall', { cwd: path }) const result = await execAsync('git status --porcelain -uall', { cwd: path })
//console.log('git status --porcelain -uall', result.stdout) //console.log('git status --porcelain -uall', result.stdout)

Loading…
Cancel
Save