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-gc.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-gc.c')
| -rw-r--r-- | builtin-gc.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/builtin-gc.c b/builtin-gc.c index f8eae4adb4..a2014388da 100644 --- a/builtin-gc.c +++ b/builtin-gc.c @@ -144,34 +144,6 @@ static int too_many_packs(void) return gc_auto_pack_limit <= cnt; } -static int run_hook(void) -{ - const char *argv[2]; - struct child_process hook; - int ret; - - argv[0] = git_path("hooks/pre-auto-gc"); - argv[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; - - ret = start_command(&hook); - if (ret) { - warning("Could not spawn %s", argv[0]); - return ret; - } - ret = finish_command(&hook); - if (ret == -ERR_RUN_COMMAND_WAITPID_SIGNAL) - warning("%s exited due to uncaught signal", argv[0]); - return ret; -} - static int need_to_gc(void) { /* @@ -194,7 +166,7 @@ static int need_to_gc(void) else if (!too_many_loose_objects()) return 0; - if (run_hook()) + if (run_hook(NULL, "pre-auto-gc", NULL)) return 0; return 1; } |
