Re: [TOPIC 2/17] Hooks in the future
- From
Emily Shaffer <emilyshaffer@google.com>
- Date
- Apr 8, 2020, 01:09 UTC
- Message-ID
- <20200408010904.GF137962@google.com>
- In-Reply-To
- <xmqq4ktures1.fsf@gitster.c.googlers.com>
On Tue, Apr 07, 2020 at 05:40:14PM -0700, Junio C Hamano wrote:
Show 29 quoted lines
> Emily Shaffer <emilyshaffer@google.com> writes: > > > [hook "unique-name"] > > pre-commit = ~/path-to-hook.sh args-for-precommit > > pre-push = ~/path-to-hook.sh > > order = 001 > > > > Then, in another config: > > > > hook.unique-name.pre-push-order = 123 > > > > or, > > > > hook.unique-name.enable = false > > hook.unique-name.pre-commit-enable = true > > > > To pick it apart a little more: > > > > - Let's give each logical action a unique name, e.g. "git-secrets". > > - Users can sign up for a certain event by providing the command to > > run, e.g. `hook.git-secrets.pre-commit = git-secrets pre-commit`. > > - Users can set up defaults for the logical action, e.g. > > `hook.git-secrets.before = gerrit` (where "gerrit" is the unique name > > for another logical action), and then change it on a per-hook basis > > e.g. `hook.git-secrets.pre-commit-before = clang-tidy` > > Sorry, but the description and the tokens used in there are so > detached from the current reality that I am having a hard time > trying to even guess what you two were talking about.
Ack, sorry about that. Point taken.
Show 6 quoted lines
> > For example, how would I express that I am using program X as my > 'push-to-checkout' hook in a way consistent with the above > description? Would "push" correspond to your "git-secrets" and > "checkout" to your "pre-commit", or would these be placed where you > wrote "unique-name"?
If you are using program X, which lives at /bin/x, and you want to use it as your push-to-checkout hook:
[hook "x"] push-to-checkout = /bin/x
"unique-name" is unique and arbitrary, which is why I mentioned it could be either difficult to machine-generate or difficult to human-read.
- Emily