From 7d542ad350a5733016504a97c0bda4d0e4ff0e43 Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Tue, 24 May 2022 09:35:09 +0800 Subject: [PATCH] Use cwd in command args instead of spawn args Some git services are ok with using paths in args instead of previously specifying it in spawning processes. --- src/modules/git/Git.service.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/git/Git.service.ts b/src/modules/git/Git.service.ts index 50628f7..3616279 100644 --- a/src/modules/git/Git.service.ts +++ b/src/modules/git/Git.service.ts @@ -26,29 +26,29 @@ export class GitServiceImpl implements GitService { async advertiseReceivePackRefs(cwd: string): Promise { const command = GitServiceImpl.isWindows() ? 'git' : 'git-receive-pack'; - const commonArgs = ['--stateless-rpc', '--advertise-refs', '.']; + const commonArgs = ['--stateless-rpc', '--advertise-refs', cwd]; const args = GitServiceImpl.isWindows() ? ['receive-pack', ...commonArgs] : commonArgs; - return spawn(command, args, { cwd }); + return spawn(command, args); } async advertiseUploadPackRefs(cwd: string): Promise { const command = GitServiceImpl.isWindows() ? 'git' : 'git-upload-pack'; - const commonArgs = ['--stateless-rpc', '--advertise-refs', '.']; + const commonArgs = ['--stateless-rpc', '--advertise-refs', cwd]; const args = GitServiceImpl.isWindows() ? ['upload-pack', ...commonArgs] : commonArgs; - return spawn(command, args, { cwd }); + return spawn(command, args); } async receivePack(cwd: string): Promise { const command = GitServiceImpl.isWindows() ? 'git' : 'git-receive-pack'; - const commonArgs = ['--stateless-rpc', '.']; + const commonArgs = ['--stateless-rpc', cwd]; const args = GitServiceImpl.isWindows() ? ['receive-pack', ...commonArgs] : commonArgs; - return spawn(command, args, { cwd }); + return spawn(command, args); } async uploadPack(cwd: string): Promise { const command = GitServiceImpl.isWindows() ? 'git' : 'git-upload-pack'; - const commonArgs = ['--stateless-rpc', '.']; + const commonArgs = ['--stateless-rpc', cwd]; const args = GitServiceImpl.isWindows() ? ['upload-pack', ...commonArgs] : commonArgs; - return spawn(command, args, { cwd }); + return spawn(command, args); } }