diff --git a/source/git-api.js b/source/git-api.js index 53406fae4..962d01a51 100644 --- a/source/git-api.js +++ b/source/git-api.js @@ -10,6 +10,8 @@ const gitPromise = require('./git-promise'); const fs = require('./utils/fs-async'); const ignore = require('ignore'); const Bluebird = require('bluebird'); +const crypto = require('crypto'); +const nodegit = require('nodegit'); const isMac = /^darwin/.test(process.platform); const isWindows = /^win/.test(process.platform); @@ -219,10 +221,9 @@ exports.registerApi = (env) => { }); app.post(`${exports.pathPrefix}/init`, ensureAuthenticated, ensurePathExists, (req, res) => { - jsonResultOrFailProm( - res, - gitPromise(req.body.bare ? ['init', '--bare', '--shared'] : ['init'], req.body.path) - ); + var path = req.body.path; + var is_bare = req.body.bare ? 1 : 0; // nodegit requires a number https://github.com/nodegit/nodegit/issues/538 + jsonResultOrFailProm(res, nodegit.Repository.init(path, is_bare)); }); app.post(