X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-gc.c;h=a2014388dad65fab8c7d32baf275295a0e36b210;hb=e80f97e20c8122f79450e1f40f569df0b52773e9;hp=f8eae4adb41d9c338c07aa161e7305bb16742a1e;hpb=b044c65855c79f627b002d77b5ed469bf3f0df0e;p=git.git diff --git a/builtin-gc.c b/builtin-gc.c index f8eae4adb..a2014388d 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; }