push rpc command draft improved

Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
dzdidi
2024-01-23 23:27:26 +00:00
parent cf038ff27a
commit c146669a11
2 changed files with 11 additions and 10 deletions

View File

@@ -121,11 +121,10 @@ async function talkToGit (refs, drive, repoName, rpc) {
const publicKey = home.readPk()
const res = await rpc.request(command, Buffer.from(`${publicKey}/${repoName}:${dst}`))
console.error('killing', daemonPid)
process.kill(daemonPid || home.getDaemonPid())
console.error('killed')
home.removeDaemonPid()
process.stdout.write(res.toString())
process.stdout.write('\n\n')
process.exit(0)
} else if (chunk && chunk.search(/^list/) !== -1) { // list && list for-push

View File

@@ -44,24 +44,26 @@ module.exports = class RPC {
pushHandler (req) {
// TODO: check ACL
// XXX: from the inside of a bare repo:
// git fetch url <branch>:<branch>
// collect stdout to buffer and return it
// const process = spawn('git', ['fetch', url, `${branch}:${branch}`], { env: { GIT_DIR: getCodePath(name) } })
console.error('req', req.toString())
console.error('pushHandler not implemented')
}
forcePushHandler (req) {
// TODO: check ACL
// XXX: from the inside of a bare repo:
// git reset --hard url <branch>
// TODO:
// check ACL
// collect stdout to buffer and return it
// const process = spawn('git', ['reset', '--hard', url, branch], { env: { GIT_DIR: getCodePath(name) } })
console.error('req', req.toString())
console.error('forcePushHandler not implemented')
}
deleteBranchHandler (req) {
// TODO: check ACL
// XXX: from the inside of a bare repo:
// git push -d pear <branch>
// TODO:
// check ACL
// collect stdout to buffer and return it
// const process = spawn('git', ['branch', '-d', branch], { env: { GIT_DIR: getCodePath(name) } })
console.error('req', req.toString())
console.error('deleteBranchHandler not implemented')
}