tarmolov / git-hooks-js

A tool to manage and run project git hooks
167 stars 30 forks source link

Use existence of backup as marker for installation #54

Closed rjmunro closed 6 years ago

rjmunro commented 6 years ago

Prior to this PR, on uninstallation, you would only get a git-hooks is not installed error if there was no .git/hooks folder, but installation would never remove that folder. It would replace it, if there was a backup to replace it with, or leave it if there was not.

In practise having no hooks folder would never happen as git will automatically create a hooks folder with samples by default. You have to take steps to remove it.

After this PR, install will always make a backup of the current hooks folder, or make a placeholder if it didn't exist. It will use the presence of this backup to detect if it has been installed, and uninstall correctly, giving an error whenever it is not installed, even if the user already had manually added git hooks for the project.

I've been working on a solution to https://github.com/tarmolov/git-hooks-js/issues/48, but couldn't get new tests to pass until I sorted out this anomaly.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+1.01%) to 94.949% when pulling 6a1945efa5e41a934146ba3c823590fc69426d0c on rjmunro:feature/always-backup-hooks into aaf26a1364e10049e9e9bfddfb77935de5a8699c on tarmolov:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+1.01%) to 94.949% when pulling 6a1945efa5e41a934146ba3c823590fc69426d0c on rjmunro:feature/always-backup-hooks into aaf26a1364e10049e9e9bfddfb77935de5a8699c on tarmolov:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+1.01%) to 94.949% when pulling 6a1945efa5e41a934146ba3c823590fc69426d0c on rjmunro:feature/always-backup-hooks into aaf26a1364e10049e9e9bfddfb77935de5a8699c on tarmolov:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+2.02%) to 95.96% when pulling 2597d0e06e0a0514236ca2e3c96f875055e614f8 on rjmunro:feature/always-backup-hooks into aaf26a1364e10049e9e9bfddfb77935de5a8699c on tarmolov:master.