mirror of
https://github.com/aljazceru/gitpear.git
synced 2025-12-17 14:14:22 +01:00
@@ -28,21 +28,21 @@ const repoName = matches[2]
|
|||||||
const store = new Corestore(RAM)
|
const store = new Corestore(RAM)
|
||||||
const swarm = new Hyperswarm({ keypair: home.getKeyPair() })
|
const swarm = new Hyperswarm({ keypair: home.getKeyPair() })
|
||||||
|
|
||||||
// let daemonPid
|
let daemonPid
|
||||||
// if (!home.isDaemonRunning()) {
|
if (!home.isDaemonRunning()) {
|
||||||
// const opts = {
|
const opts = {
|
||||||
// detached: true,
|
detached: true,
|
||||||
// stdio: [ 'ignore', home.getOutStream(), home.getErrStream() ]
|
stdio: [ 'ignore', home.getOutStream(), home.getErrStream() ]
|
||||||
// }
|
}
|
||||||
// const daemon = spawn('git-peard', opts)
|
const daemon = spawn('git-peard', opts)
|
||||||
// daemonPid = daemon.pid
|
daemonPid = daemon.pid
|
||||||
// home.storeDaemonPid(daemonPid)
|
home.storeDaemonPid(daemonPid)
|
||||||
// // TODO: remove in case of error or exit but allow unref
|
// TODO: remove in case of error or exit but allow unref
|
||||||
// // daemon.on('error', home.removeDaemonPid)
|
// daemon.on('error', home.removeDaemonPid)
|
||||||
// // daemon.on('exit', home.removeDaemonPid)
|
// daemon.on('exit', home.removeDaemonPid)
|
||||||
// console.error('started daemon', daemonPid)
|
console.error('started daemon', daemonPid)
|
||||||
// daemon.unref()
|
daemon.unref()
|
||||||
// }
|
}
|
||||||
|
|
||||||
swarm.join(crypto.discoveryKey(Buffer.from(targetKey, 'hex')), { server: false })
|
swarm.join(crypto.discoveryKey(Buffer.from(targetKey, 'hex')), { server: false })
|
||||||
|
|
||||||
@@ -110,17 +110,20 @@ async function talkToGit (refs, drive, repoName, rpc) {
|
|||||||
await git.push(src, isForce)
|
await git.push(src, isForce)
|
||||||
src = src.replace('+', '')
|
src = src.replace('+', '')
|
||||||
command = 'f-push'
|
command = 'f-push'
|
||||||
|
console.warn('To', url)
|
||||||
} else {
|
} else {
|
||||||
console.warn('pushing', src, dst)
|
|
||||||
await git.push(src)
|
await git.push(src)
|
||||||
command = 'push'
|
command = 'push'
|
||||||
|
console.warn('To', url)
|
||||||
}
|
}
|
||||||
|
|
||||||
const publicKey = home.readPk()
|
const publicKey = home.readPk()
|
||||||
const res = await rpc.request(command, Buffer.from(`${publicKey}/${repoName}:${dst}`))
|
const res = await rpc.request(command, Buffer.from(`${publicKey}/${repoName}:${dst}`))
|
||||||
|
|
||||||
// process.kill(daemonPid || home.getDaemonPid())
|
if (daemonPid) {
|
||||||
// home.removeDaemonPid()
|
process.kill(daemonPid)
|
||||||
|
home.removeDaemonPid()
|
||||||
|
}
|
||||||
|
|
||||||
process.stdout.write('\n\n')
|
process.stdout.write('\n\n')
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user