Skip to content

Commit aaf26a1

Browse files
committed
Running --uninstall twice removes the preexisting hooks fixed #53
1 parent 6ecfc65 commit aaf26a1

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/git-hooks.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ module.exports = {
9090
throw new Error('git-hooks is not installed');
9191
}
9292

93-
fsHelpers.removeDir(hooksPath);
94-
9593
if (fsHelpers.exists(hooksOldPath)) {
94+
fsHelpers.removeDir(hooksPath);
9695
fs.renameSync(hooksOldPath, hooksPath);
9796
}
9897
},

tests/uninstall.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ describe('--uninstall', function () {
3838
});
3939
});
4040

41-
describe('when git-hooks is installed', function () {
41+
describe('when backup is absent', function () {
4242
beforeEach(function () {
4343
fsHelpers.makeDir(GIT_HOOKS);
4444
});
4545

46-
it('should remove hooks directory', function () {
46+
it('should not remove hooks directory', function () {
4747
gitHooks.uninstall(SANDBOX_PATH);
48-
fsHelpers.exists(GIT_HOOKS).should.be.false;
48+
fsHelpers.exists(GIT_HOOKS).should.be.true;
4949
});
5050
});
5151

0 commit comments

Comments
 (0)