Closed whisperity closed 4 years ago
This should work, hm... lets see
Ok, it seems, shared hooks enabling/disabling is not implemented yet. So only local hooks work.
disable_hook()
for
git hooks disable <trigger> <url-abrev|shared-repo-abbvre> <hook-name>`
which would handle the disabling/enabling ot per repo basis.
.ignore
file, which would let you ignore shared hooks per repo basis.But saying this, extending to this functionality I am questioning if this manager should stay in "shell". Maybe just rewrite it in GO... :-P. Lots of work, especially the 110 unit tests...
Pushed a change that introduces --shared
for git hooks enable|disable|accept
, see the docs here: https://github.com/rycus86/githooks/blob/master/docs/command-line-tool.md
Let me know how this works out for you!
What happens if we have 2 shared repos with the same hook name? And we disable them? Thanks for the changes?
I think we'll always just find the first one.
I believe this is what would happen already if you'd have .githooks/pre-commit/something
and .githooks/post-commit/something
in the same local repo and do a git hooks disable something
I'm not too worried about this case though, you wouldn't do it in the local repo (or it's at least easy to fix), the problem os if two shared repos give you the same named hook files. Let's worry about this when it's reported as an issue.
I tried it out, but the code hard-requires the hooks themselves to be in <repo>/.githooks
even in the share, whereas the list
command finds the hooks even if the script's path is <shared-repo>/pre-commit/git-clang-format
.
It is not documented anywhere that shares should also contain scripts in a .githooks
directory. I think this either needs to be documented, or the logic expanded to search in the "root directory" of the checked out shares, as using a directory with .
in a repository meant to contain just hooks is rather clunky: .
inodes are hidden by default...
Doing an cd ~/.githooks/shared/<repo-name>/; ln -s . .githooks
does fix the issue, so the overall logic for searching inside the share does work.
That's right, I'll have a look at that.
OK, added a new test without the .githooks
folder in the shared repo, hopefully this should do it.
Thanks, tried it out in the wild, and seems to work fine. :tada:
If a shared hook is disabled (by hand at the question), the following pop-up happens next time it would be executed:
Problem is, saying
git hooks enable pre-commit git-clang-format
will just error withSorry, cannot find any hooks that would match that
, even thoughgit hooks list
says:Editing the "checksum" file works, but it seems the logic to find a hook inside a pulled share is missing.
How I set my working directory up is that I set my own git-hooks repo as a local share and then ran
git hooks shared update
.