Use existence of backup as marker for installation #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
.git
. Create it in /tmp/ so that we don't walk up the tree to the repo of this project.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 #48, but couldn't get new tests to pass until I sorted out this anomaly.