Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use existence of backup as marker for installation #54

Merged
merged 2 commits into from
May 2, 2018

Conversation

rjmunro
Copy link
Contributor

@rjmunro rjmunro commented May 1, 2018

  • Always make a backup when installing
  • Always check for backup when uninstalling - use presence of backup to indicate if we are installed.
  • Use a real git repository in tests, not just a folder called .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.

* Always make a backup when installing
* Always check for backup when uninstalling
@coveralls
Copy link

Coverage Status

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

2 similar comments
@coveralls
Copy link

Coverage Status

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

@coveralls
Copy link

Coverage Status

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

@coveralls
Copy link

coveralls commented May 1, 2018

Coverage Status

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

@tarmolov tarmolov merged commit e83af69 into tarmolov:master May 2, 2018
@rjmunro rjmunro deleted the feature/always-backup-hooks branch May 3, 2018 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants