Open dwightmulcahy opened 5 years ago
depending on if #7 is implemented it might be better to have something like <overwrite-strategy>
that would allow overwrite
, chain
, backup
, etc...
Somewhat related to this, the plugin shouldn't do anything at all if the hash of the existing hook matches what it's trying to write (only do file modifications if necessary).
Also, I think the default behavior should be to overwrite, but maybe warn or prompt or something if it's the first time it's happening? There are 2 use cases of "existing" hooks:
pom.xml
Use case: maybe the
pre-commit
hook takes a few seconds to run, v1 of the hook doesn't have any progress indicators, now the user writes v2 with progress indicators
Maybe we can differentiate between those 2 cases with a comment at the top of the file like #written by githook-maven-plugin
. Need to think about upgradeability though, people have been using this plugin already and their existing hooks will not have this header.
something like this
should create an ERROR (but continue) if overwrite==true and file exists...