hooks: allow customizing where the hook directory is
[gitweb.git] / run-command.c
index c72601056cf5ae7be2593ae89af4effc26a1b043..aa85cd5c3ccd343df4727217089ec3c6055735cc 100644 (file)
@@ -815,7 +815,10 @@ const char *find_hook(const char *name)
        static struct strbuf path = STRBUF_INIT;
 
        strbuf_reset(&path);
-       strbuf_git_path(&path, "hooks/%s", name);
+       if (git_hooks_path)
+               strbuf_addf(&path, "%s/%s", git_hooks_path, name);
+       else
+               strbuf_git_path(&path, "hooks/%s", name);
        if (access(path.buf, X_OK) < 0)
                return NULL;
        return path.buf;