Skip to content

Commit

Permalink
replace init
Browse files Browse the repository at this point in the history
  • Loading branch information
ylecuyer authored and wmertens committed Apr 27, 2020
1 parent b7b363b commit b355257
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions source/git-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit b355257

Please sign in to comment.