Closed gabyx closed 3 years ago
In terms of CLI, I think in the https://github.com/rycus86/githooks/blob/master/docs/command-line-tool.md#git-hooks-config git hooks config shared <url>
could maybe get a --local
flag to only set this for the current repo.
For the logic, everything could work as-is, maybe there's some merging needed for local+global git configs for the shared repo lists. Other than that the only thing I'd want is to refuse running local (and/or file://
) repo hooks from the .shared
file (because someone else can update it for you).
The thing is there is already a —local flag, isnt it? Which puts the url into the .shared file...
Von meinem iPhone gesendet
Am 13.09.2020 um 11:18 schrieb Viktor Adam notifications@github.com:
In terms of CLI, I think in the https://github.com/rycus86/githooks/blob/master/docs/command-line-tool.md#git-hooks-config git hooks config shared
could maybe get a --local flag to only set this for the current repo. For the logic, everything could work as-is, maybe there's some merging needed for local+global git configs for the shared repo lists. Other than that the only thing I'd want is to refuse running local (and/or file://) repo hooks from the .shared file (because someone else can update it for you).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Oh, you're right, there is. 🙈 I was only checking the cli docs and that doesn't tell about it.
Looking back now, I don't think --local
is appropriate for changing the .shared
file, I'd probably use --shared
for that, then --local
could just set the local git config variable.
That would be 👌 :)
Von meinem iPhone gesendet
Am 13.09.2020 um 12:00 schrieb Viktor Adam notifications@github.com:
Oh, you're right, there is. 🙈 I was only checking the cli docs and that doesn't tell about it.
Looking back now, I don't think --local is appropriate for changing the .shared file, I'd probably use --shared for that, then --local could just set the local git config variable.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
OK, I suggest the following:
githooks.shared
in the local and global git config and the cligit hooks shared add|remove --local|--global <url>
will work with the git config githooks.shared
git hooks shared add|remove [--shared] <url>
will work with the .shared
file. This is the default behavior.git hooks shared list --local|--global <url>
will show --local or --global githooks.shared
git hooks shared list [--shared] <url>
will show the .shared
file.git hooks shared list --all
will show the .shared
and githooks.shared
configs.githooks.shared
in any local/global githooks.shared
or the ones in .shared
file, we track all used SHARED_ROOT
paths and skip if we have already executed hooks in this shared repo. This is currently not checked.Then the executing sequence should be now as follows, (IMO):
execute_shared_hooks --shared "$@" || return 1 # .shared file
execute_shared_hooks --local "$@" || return 1 # first --local git config: githooks.shared,
execute_shared_hooks --global "$@" || return 1 # then --global git config: githooks.shared
execute_all_hooks_in "$(pwd)/.githooks" "$@" || return 1
Sounds good to me, thanks!
@rycus: For your suggestion #119 , we might need clear notation what we mean with global shared hooks, local shared hooks and the new global shared hooks for this repo only.
—local is currently .shared file
—global is global githooks.shared
I am wondering how we make this CLI option. Should we keep the definition or have something like: