Skip to content

Commit

Permalink
https://github.com/haxtheweb/issues/issues/2162
Browse files Browse the repository at this point in the history
  • Loading branch information
btopro committed Oct 7, 2024
1 parent b77661a commit e0f23b4
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions src/lib/GitPlus.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,39 @@ const { Git } = require('git-interface');
const util = require('node:util');
const child_process = require('child_process');
const exec = util.promisify(child_process.exec);
var hasGit = true;
exec('git --version', error => {
if (error) {
hasGit = false;
async function hasGit() {
let cliOut = true;
try {
const { stdout, stderr } = await exec('git --version');
cliOut = stdout;
} catch (e) {
cliOut = false;
}
});
console.log(hasGit);

if (hasGit) {
class GitPlus extends Git {
async revert(count) {
let counter = 0;
// sanity check
if (count < 1) {
count = 1;
console.log(cliOut);
if (cliOut) {
class GitPlus extends Git {
async revert(count) {
let counter = 0;
// sanity check
if (count < 1) {
count = 1;
}
while (counter != count) {
await this.gitExec("reset --hard HEAD~1");
counter++;
}
return true;
}
while (counter != count) {
await this.gitExec("reset --hard HEAD~1");
counter++;
}
return true;
}
module.exports = GitPlus;
}
module.exports = GitPlus;
}
else {
class GitPlus {
constructor() {

else {
class GitPlus {
constructor() {

}
}
module.exports = GitPlus;
}
module.exports = GitPlus;
}
}
hasGit();

0 comments on commit e0f23b4

Please sign in to comment.