From 1781ca2f9957d29a0a24c8a9f5727159f315b7dc Mon Sep 17 00:00:00 2001 From: dzdidi Date: Tue, 16 Jan 2024 09:23:38 +0000 Subject: [PATCH] identify delete and force flags Signed-off-by: dzdidi --- src/git-remote-pear.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/git-remote-pear.js b/src/git-remote-pear.js index ce4bd9f..2822cea 100755 --- a/src/git-remote-pear.js +++ b/src/git-remote-pear.js @@ -70,22 +70,16 @@ async function talkToGit (refs, drive) { process.stdin.on('readable', async function () { const chunk = process.stdin.read() if (chunk === 'capabilities\n') { - process.stdout.write('list\n') // TODO: support push - process.stdout.write('push\n') // TODO: support push + process.stdout.write('list\n') + process.stdout.write('push\n') process.stdout.write('fetch\n\n') } else if (chunk && chunk.search(/^push/) !== -1) { - let [src, dst] = chunk.split(':') - src = src.split(' ')[1] - const isForce = src.startsWith('+') - if (isForce) { - src = src.slice(1) - console.warn('force push is disabled') - process.stdout.write('\n\n') - process.exit(0) - } + const [_command, path] = chunk.split(' ') + const [src, dst] = path.split(':') + + const isDelete = !src + const isForce = src.startsWith('+') - // TODO: write to something - console.warn('src:', src, 'dst:', dst) process.stdout.write('\n\n') process.exit(0) } else if (chunk && chunk.search(/^list/) !== -1) { // list && list for-push