Skip to content

Commit 4c974e3

Browse files
committed
Merge branch 'master' of github.com:gabrielcsapo/node-git-server
2 parents dd20baf + f19a1c1 commit 4c974e3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/service.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const through = require('through');
22
const zlib = require('zlib');
33
const util = require('util');
4+
const os = require('os');
45
const { spawn } = require('child_process');
56

67
const HttpDuplex = require('./http-duplex');
@@ -103,7 +104,11 @@ class Service extends HttpDuplex {
103104

104105
self.once('accept', function onAccept() {
105106
process.nextTick(function() {
106-
const cmd = ['git-' + opts.service, '--stateless-rpc', opts.cwd];
107+
const cmd = os.platform() == 'win32' ?
108+
['git', opts.service, '--stateless-rpc', opts.cwd]
109+
:
110+
['git-' + opts.service, '--stateless-rpc', opts.cwd];
111+
107112
const ps = spawn(cmd[0], cmd.slice(1));
108113

109114
ps.on('error', function(err) {

lib/util.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@ const Util = {
8484
res.write(pack('# service=git-' + service + '\n'));
8585
res.write('0000');
8686

87-
const cmd = ['git-' + service, '--stateless-rpc', '--advertise-refs', repoLocation];
87+
var cmd = null;
88+
var isWin = /^win/.test(process.platform);
89+
if (isWin) {
90+
cmd = ['git', service, '--stateless-rpc', '--advertise-refs', repoLocation];
91+
} else {
92+
cmd = ['git-' + service, '--stateless-rpc', '--advertise-refs', repoLocation];
93+
}
94+
8895
const ps = spawn(cmd[0], cmd.slice(1));
8996
ps.on('error', (err) => {
9097
dup.emit('error', new Error(`${err.message} running command ${cmd.join(' ')}`));

0 commit comments

Comments
 (0)