Skip to content

Commit

Permalink
Running --uninstall twice removes the preexisting hooks fixed #53
Browse files Browse the repository at this point in the history
  • Loading branch information
tarmolov committed Apr 7, 2018
1 parent 6ecfc65 commit aaf26a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/git-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ module.exports = {
throw new Error('git-hooks is not installed');
}

fsHelpers.removeDir(hooksPath);

if (fsHelpers.exists(hooksOldPath)) {
fsHelpers.removeDir(hooksPath);
fs.renameSync(hooksOldPath, hooksPath);
}
},
Expand Down
6 changes: 3 additions & 3 deletions tests/uninstall.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ describe('--uninstall', function () {
});
});

describe('when git-hooks is installed', function () {
describe('when backup is absent', function () {
beforeEach(function () {
fsHelpers.makeDir(GIT_HOOKS);
});

it('should remove hooks directory', function () {
it('should not remove hooks directory', function () {
gitHooks.uninstall(SANDBOX_PATH);
fsHelpers.exists(GIT_HOOKS).should.be.false;
fsHelpers.exists(GIT_HOOKS).should.be.true;
});
});

Expand Down

0 comments on commit aaf26a1

Please sign in to comment.