diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-01-21 16:50:43 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-21 16:50:43 -0800 |
commit | 1afcde6da1221bdb85a3630d995f9ca384042cb9 (patch) | |
tree | 9a010c9a301e5574aacd6d56a48e9c18d9496bb0 /builtin-commit.c | |
parent | 35e6afd4c6bc73cba7bc279ff43b498389bf805a (diff) | |
parent | 14e6298f1215da503f0f65b63e13d674dd781868 (diff) | |
download | git-1afcde6da1221bdb85a3630d995f9ca384042cb9.tar.gz |
Merge branch 'sb/hook-cleanup'
* sb/hook-cleanup:
run_hook(): allow more than 9 hook arguments
run_hook(): check the executability of the hook before filling argv
api-run-command.txt: talk about run_hook()
Move run_hook() from builtin-commit.c into run-command.c (libgit)
checkout: don't crash on file checkout before running post-checkout hook
Diffstat (limited to 'builtin-commit.c')
-rw-r--r-- | builtin-commit.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/builtin-commit.c b/builtin-commit.c index b159af2e54..7aaa5304c7 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -361,40 +361,6 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int return s.commitable; } -static int run_hook(const char *index_file, const char *name, ...) -{ - struct child_process hook; - const char *argv[10], *env[2]; - char index[PATH_MAX]; - va_list args; - int i; - - va_start(args, name); - argv[0] = git_path("hooks/%s", name); - i = 0; - do { - if (++i >= ARRAY_SIZE(argv)) - die ("run_hook(): too many arguments"); - argv[i] = va_arg(args, const char *); - } while (argv[i]); - va_end(args); - - snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file); - env[0] = index; - env[1] = NULL; - - if (access(argv[0], X_OK) < 0) - return 0; - - memset(&hook, 0, sizeof(hook)); - hook.argv = argv; - hook.no_stdin = 1; - hook.stdout_to_stderr = 1; - hook.env = env; - - return run_command(&hook); -} - static int is_a_merge(const unsigned char *sha1) { struct commit *commit = lookup_commit(sha1); |