File tree Expand file tree Collapse file tree 5 files changed +29
-23
lines changed
Expand file tree Collapse file tree 5 files changed +29
-23
lines changed Original file line number Diff line number Diff line change @@ -2675,7 +2675,7 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
26752675
26762676help.sp help.s help.o : command-list.h
26772677builtin/bugreport.sp builtin/bugreport.s builtin/bugreport.o : hook-list.h
2678- builtin/ hook.sp builtin/ hook.s builtin/ hook.o : hook-list.h
2678+ hook.sp hook.s hook.o : hook-list.h
26792679
26802680builtin/help.sp builtin/help.s builtin/help.o : config-list.h GIT-PREFIX
26812681builtin/help.sp builtin/help.s builtin/help.o : EXTRA_CPPFLAGS = \
Original file line number Diff line number Diff line change 44#include "environment.h"
55#include "gettext.h"
66#include "hook.h"
7- #include "hook-list.h"
87#include "parse-options.h"
98
109#define BUILTIN_HOOK_RUN_USAGE \
1312#define BUILTIN_HOOK_LIST_USAGE \
1413 N_("git hook list [--allow-unknown-hook-name] [-z] [--show-scope] <hook-name>")
1514
16- static int is_known_hook (const char * name )
17- {
18- const char * * p ;
19- for (p = hook_name_list ; * p ; p ++ )
20- if (!strcmp (* p , name ))
21- return 1 ;
22- return 0 ;
23- }
24-
2515static const char * const builtin_hook_usage [] = {
2616 BUILTIN_HOOK_RUN_USAGE ,
2717 BUILTIN_HOOK_LIST_USAGE ,
Original file line number Diff line number Diff line change 55#include "environment.h"
66#include "gettext.h"
77#include "hook.h"
8+ #include "hook-list.h"
89#include "parse.h"
910#include "path.h"
1011#include "run-command.h"
1112#include "setup.h"
1213#include "strbuf.h"
1314#include "strmap.h"
1415
16+ bool is_known_hook (const char * name )
17+ {
18+ const char * * h ;
19+ for (h = hook_name_list ; * h ; h ++ )
20+ if (!strcmp (* h , name ))
21+ return true;
22+ return false;
23+ }
24+
1525const char * find_hook (struct repository * r , const char * name )
1626{
1727 static struct strbuf path = STRBUF_INIT ;
Original file line number Diff line number Diff line change @@ -234,6 +234,12 @@ void hook_free(void *p, const char *str);
234234 */
235235void hook_cache_clear (struct strmap * cache );
236236
237+ /**
238+ * Returns true if `name` is a recognized hook event name
239+ * (e.g. "pre-commit", "post-receive").
240+ */
241+ bool is_known_hook (const char * name );
242+
237243/**
238244 * Returns the path to the hook file, or NULL if the hook is missing
239245 * or disabled. Note that this points to static storage that will be
Original file line number Diff line number Diff line change @@ -563,6 +563,18 @@ libgit_sources += custom_target(
563563 env : script_environment,
564564)
565565
566+ libgit_sources += custom_target (
567+ input : ' Documentation/githooks.adoc' ,
568+ output : ' hook-list.h' ,
569+ command : [
570+ shell,
571+ meson .current_source_dir() + ' /tools/generate-hooklist.sh' ,
572+ meson .current_source_dir(),
573+ ' @OUTPUT@' ,
574+ ],
575+ env : script_environment,
576+ )
577+
566578builtin_sources = [
567579 ' builtin/add.c' ,
568580 ' builtin/am.c' ,
@@ -739,18 +751,6 @@ builtin_sources += custom_target(
739751 env : script_environment,
740752)
741753
742- builtin_sources += custom_target (
743- input : ' Documentation/githooks.adoc' ,
744- output : ' hook-list.h' ,
745- command : [
746- shell,
747- meson .current_source_dir() + ' /tools/generate-hooklist.sh' ,
748- meson .current_source_dir(),
749- ' @OUTPUT@' ,
750- ],
751- env : script_environment,
752- )
753-
754754# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
755755# build options to our tests.
756756build_options_config = configuration_data ()
You can’t perform that action at this time.
0 commit comments