trace2:data: add trace2 hook classification

Classify certain child processes as hooks. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff Hostetler committed Feb 22, 2019 at 14:25 UTC 6206286e49b88bd4bb709c62e7b7455685c1993a
5 files changed +9
builtin/am.c
+1
@@ -453,6 +453,7 @@ static int run_post_rewrite_hook(const struct am_state *state)
453
454 cp.in = xopen(am_path(state, "rewritten"), O_RDONLY);
455 cp.stdout_to_stderr = 1;
456 + cp.trace2_hook_name = "post-rewrite";
457
458 ret = run_command(&cp);
459
builtin/receive-pack.c
+4
@@ -694,6 +694,8 @@ static int run_and_feed_hook(const char *hook_name, feed_fn feed,
694 proc.argv = argv;
695 proc.in = -1;
696 proc.stdout_to_stderr = 1;
697 + proc.trace2_hook_name = hook_name;
698 +
699 if (feed_state->push_options) {
700 int i;
701 for (i = 0; i < feed_state->push_options->nr; i++)
@@ -807,6 +809,7 @@ static int run_update_hook(struct command *cmd)
809 proc.stdout_to_stderr = 1;
810 proc.err = use_sideband ? -1 : 0;
811 proc.argv = argv;
812 + proc.trace2_hook_name = "update";
813
814 code = start_command(&proc);
815 if (code)
@@ -1190,6 +1193,7 @@ static void run_update_post_hook(struct command *commands)
1193 proc.no_stdin = 1;
1194 proc.stdout_to_stderr = 1;
1195 proc.err = use_sideband ? -1 : 0;
1196 + proc.trace2_hook_name = "post-update";
1197
1198 if (!start_command(&proc)) {
1199 if (use_sideband)
builtin/worktree.c
+1
@@ -402,6 +402,7 @@ done:
402 cp.dir = path;
403 cp.env = env;
404 cp.argv = NULL;
405 + cp.trace2_hook_name = "post-checkout";
406 argv_array_pushl(&cp.args, absolute_path(hook),
407 oid_to_hex(&null_oid),
408 oid_to_hex(&commit->object.oid),
sequencer.c
+2
@@ -1103,6 +1103,7 @@ static int run_rewrite_hook(const struct object_id *oldoid,
1103 proc.argv = argv;
1104 proc.in = -1;
1105 proc.stdout_to_stderr = 1;
1106 + proc.trace2_hook_name = "post-rewrite";
1107
1108 code = start_command(&proc);
1109 if (code)
@@ -3786,6 +3787,7 @@ cleanup_head_ref:
3787 hook.in = open(rebase_path_rewritten_list(),
3788 O_RDONLY);
3789 hook.stdout_to_stderr = 1;
3790 + hook.trace2_hook_name = "post-rewrite";
3791 argv_array_push(&hook.args, post_rewrite_hook);
3792 argv_array_push(&hook.args, "rebase");
3793 /* we don't care if this hook failed */
transport.c
+1
@@ -1062,6 +1062,7 @@ static int run_pre_push_hook(struct transport *transport,
1062
1063 proc.argv = argv;
1064 proc.in = -1;
1065 + proc.trace2_hook_name = "pre-push";
1066
1067 if (start_command(&proc)) {
1068 finish_command(&proc);