
Teach 'git hook list <hookname>', which checks the known configs in order to create an ordered list of hooks to run on a given hook event. Multiple commands can be specified for a given hook by providing multiple "hook.<hookname>.command = <path-to-hook>" lines. Hooks will be run in config order. If more properties need to be set on a given hook in the future, commands can also be specified by providing "hook.<hookname>.command = <hookcmd-name>", as well as a "[hookcmd <hookcmd-name>]" subsection; at minimum, this subsection must contain a "hookcmd.<hookcmd-name>.command = <path-to-hook>" line. For example: $ git config --list | grep ^hook hook.pre-commit.command=baz hook.pre-commit.command=~/bar.sh hookcmd.baz.command=~/baz/from/hookcmd.sh $ git hook list pre-commit ~/baz/from/hookcmd.sh ~/bar.sh Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 lines
275 B
C
16 lines
275 B
C
#include "config.h"
|
|
#include "list.h"
|
|
#include "strbuf.h"
|
|
|
|
struct hook
|
|
{
|
|
struct list_head list;
|
|
enum config_scope origin;
|
|
struct strbuf command;
|
|
};
|
|
|
|
struct list_head* hook_list(const struct strbuf *hookname);
|
|
|
|
void free_hook(struct hook *ptr);
|
|
void clear_hook_list(void);
|