sequencer (rebase -i): run the post-rewrite hook, if needed

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jan 2, 2017 at 16:28 UTC 795160457db0982c44cc02f66798a35af4d15625
1 file changed +14
sequencer.c
+14
@@ -1957,6 +1957,8 @@ cleanup_head_ref:
1957 if (!stat(rebase_path_rewritten_list(), &st) &&
1958 st.st_size > 0) {
1959 struct child_process child = CHILD_PROCESS_INIT;
1960 + const char *post_rewrite_hook =
1961 + find_hook("post-rewrite");
1962
1963 child.in = open(rebase_path_rewritten_list(), O_RDONLY);
1964 child.git_cmd = 1;
@@ -1965,6 +1967,18 @@ cleanup_head_ref:
1967 argv_array_push(&child.args, "--for-rewrite=rebase");
1968 /* we don't care if this copying failed */
1969 run_command(&child);
1970 +
1971 + if (post_rewrite_hook) {
1972 + struct child_process hook = CHILD_PROCESS_INIT;
1973 +
1974 + hook.in = open(rebase_path_rewritten_list(),
1975 + O_RDONLY);
1976 + hook.stdout_to_stderr = 1;
1977 + argv_array_push(&hook.args, post_rewrite_hook);
1978 + argv_array_push(&hook.args, "rebase");
1979 + /* we don't care if this hook failed */
1980 + run_command(&hook);
1981 + }
1982 }
1983
1984 strbuf_release(&buf);