зеркало из https://github.com/microsoft/git.git
sequencer: use the new hook API for the simpler "post-rewrite" call
Change the invocation of the "post-rewrite" hook added in795160457d
(sequencer (rebase -i): run the post-rewrite hook, if needed, 2017-01-02) to use the new hook API. This leaves the more complex "post-rewrite" invocation added ina87a6f3c98
(commit: move post-rewrite code to libgit, 2017-11-17) here in sequencer.c unconverted. Here we can pass in a file's via the "in" file descriptor, in that case we don't have a file, but will need to write_in_full() to an "in" provide by the API. Support for that will be added to the hook API in the future, but we're not there yet. Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
917e080249
Коммит
96af564d27
18
sequencer.c
18
sequencer.c
|
@ -4834,8 +4834,7 @@ cleanup_head_ref:
|
||||||
if (!stat(rebase_path_rewritten_list(), &st) &&
|
if (!stat(rebase_path_rewritten_list(), &st) &&
|
||||||
st.st_size > 0) {
|
st.st_size > 0) {
|
||||||
struct child_process child = CHILD_PROCESS_INIT;
|
struct child_process child = CHILD_PROCESS_INIT;
|
||||||
const char *post_rewrite_hook =
|
struct run_hooks_opt hook_opt = RUN_HOOKS_OPT_INIT;
|
||||||
find_hook("post-rewrite");
|
|
||||||
|
|
||||||
child.in = open(rebase_path_rewritten_list(), O_RDONLY);
|
child.in = open(rebase_path_rewritten_list(), O_RDONLY);
|
||||||
child.git_cmd = 1;
|
child.git_cmd = 1;
|
||||||
|
@ -4845,18 +4844,9 @@ cleanup_head_ref:
|
||||||
/* we don't care if this copying failed */
|
/* we don't care if this copying failed */
|
||||||
run_command(&child);
|
run_command(&child);
|
||||||
|
|
||||||
if (post_rewrite_hook) {
|
hook_opt.path_to_stdin = rebase_path_rewritten_list();
|
||||||
struct child_process hook = CHILD_PROCESS_INIT;
|
strvec_push(&hook_opt.args, "rebase");
|
||||||
|
run_hooks_opt("post-rewrite", &hook_opt);
|
||||||
hook.in = open(rebase_path_rewritten_list(),
|
|
||||||
O_RDONLY);
|
|
||||||
hook.stdout_to_stderr = 1;
|
|
||||||
hook.trace2_hook_name = "post-rewrite";
|
|
||||||
strvec_push(&hook.args, post_rewrite_hook);
|
|
||||||
strvec_push(&hook.args, "rebase");
|
|
||||||
/* we don't care if this hook failed */
|
|
||||||
run_command(&hook);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
apply_autostash(rebase_path_autostash());
|
apply_autostash(rebase_path_autostash());
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче