edisonywh / committee

️⚡️ Supercharged git hooks manager in pure Elixir
MIT License
62 stars 6 forks source link

Add versioning to committee hooks #26

Closed edisonywh closed 4 years ago

edisonywh commented 4 years ago

Right now Committee will skip installation if a file contains the identifier, # committee (per #25). However this means that we won't be able to change the implementation of the runner file in the future.

With versions, we can check the version to see if we should regenerate the runner file.

With this commit, if the version field is not the same as the current version, then we will regenerate/update the hooks. If the version field is the same as the hooks however, we will skip.

edisonywh commented 4 years ago

@thiamsantos What do you think about this PR? This is what we talked about in #17 in regards to versioning.

I'm thinking whether or not we should also rename the backup to something different, so instead of a generic pre_commit.old, since now we have a version we can maybe even backup to pre_commit.version.old, but need to think about restoring as well.

Anyway let me know what you think!

thiamsantos commented 4 years ago

I'm thinking whether or not we should also rename the backup to something different, so instead of a generic pre_commit.old, since now we have a version we can maybe even backup to pre_commit.version.old, but need to think about restoring as well.

@edisonywh Personally I think renaming to just .old is enough, we don't need to think in all the possibilities on that. Usually if someone willingly will set up a git hook tool, usually he assumes to everything be handled by it, and also that any hook that he previously had will be lost. So I think we are doing more than enough adding a possibility to backup and restore, even a simple one. Not all of the tools existing out there allow something like

edisonywh commented 4 years ago

@thiamsantos Good point, having more complex backups seems a little unnecessary. 👍

edisonywh commented 4 years ago

I have updated as per suggestion, let me know what you think and then I'm going to push this to prod :)