| const char *find_hook(const char *name) |
| static struct strbuf path = STRBUF_INIT; |
| strbuf_git_path(&path, "hooks/%s", name); |
| if (access(path.buf, X_OK) < 0) { |
| strbuf_addstr(&path, STRIP_EXTENSION); |
| if (access(path.buf, X_OK) >= 0) |
| if (err == EACCES && advice_enabled(ADVICE_IGNORED_HOOK)) { |
| static struct string_list advise_given = STRING_LIST_INIT_DUP; |
| if (!string_list_lookup(&advise_given, name)) { |
| string_list_insert(&advise_given, name); |
| advise(_("The '%s' hook was ignored because " |
| "it's not set as executable.\n" |
| "You can disable this warning with " |
| "`git config advice.ignoredHook false`."), |
| int hook_exists(const char *name) |
| return !!find_hook(name); |