aboutsummaryrefslogtreecommitdiffstats
path: root/builtin-merge.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-01-21 16:50:43 -0800
committerJunio C Hamano <gitster@pobox.com>2009-01-21 16:50:43 -0800
commit1afcde6da1221bdb85a3630d995f9ca384042cb9 (patch)
tree9a010c9a301e5574aacd6d56a48e9c18d9496bb0 /builtin-merge.c
parent35e6afd4c6bc73cba7bc279ff43b498389bf805a (diff)
parent14e6298f1215da503f0f65b63e13d674dd781868 (diff)
downloadgit-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-merge.c')
-rw-r--r--builtin-merge.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/builtin-merge.c b/builtin-merge.c
index cf869751b4..e4555b0199 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -300,35 +300,6 @@ static void squash_message(void)
strbuf_release(&out);
}
-static int run_hook(const char *name)
-{
- struct child_process hook;
- const char *argv[3], *env[2];
- char index[PATH_MAX];
-
- argv[0] = git_path("hooks/%s", name);
- if (access(argv[0], X_OK) < 0)
- return 0;
-
- snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", get_index_file());
- env[0] = index;
- env[1] = NULL;
-
- if (squash)
- argv[1] = "1";
- else
- argv[1] = "0";
- argv[2] = NULL;
-
- 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 void finish(const unsigned char *new_head, const char *msg)
{
struct strbuf reflog_message = STRBUF_INIT;
@@ -374,7 +345,7 @@ static void finish(const unsigned char *new_head, const char *msg)
}
/* Run a post-merge hook */
- run_hook("post-merge");
+ run_hook(NULL, "post-merge", squash ? "1" : "0", NULL);
strbuf_release(&reflog_message);
}