From patchwork Thu Oct 10 18:36:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koji Nakamaru via GitGitGadget X-Patchwork-Id: 11184063 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D62D21864 for ; Thu, 10 Oct 2019 18:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B86F2214E0 for ; Thu, 10 Oct 2019 18:36:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sq5W4lJj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726856AbfJJSgy (ORCPT ); Thu, 10 Oct 2019 14:36:54 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39190 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726007AbfJJSgx (ORCPT ); Thu, 10 Oct 2019 14:36:53 -0400 Received: by mail-wr1-f68.google.com with SMTP id r3so9115673wrj.6 for ; Thu, 10 Oct 2019 11:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=fjrEpJ2fhUjux5ecC0FdGKxJc5Idjg81vPSBppBZbMQ=; b=Sq5W4lJjWOQC+whj7Sfef5G2UNOnkz0QOzHuMUZPgFa7xOYG/z7TRqrQCXga/jH0In 8/bMBuCaKmFnB/3JfFzu3vUtyNPXH/ulPEceh1tFsEYBgnXLqMOiKLrgsKP1MUbvSeLi 7UVdbrnnLtKzr+qwiSgdSlns+hR7Q3Hh35ARWpNIC2eh1U2tW7skYtwQh+CxXKFkBsOd D+RsAQBvRikaS9Q/zeCbfBudE7S7n7Pn2Da2tcA4oi7xODbUWGu8R1bDz4ecnZ/pJ1lp ZJPo5VFkJpm6OUUedOhdcMwYTXy46dPBlxpTbRzhGBGMLGyU0py9iluq7sbjGAbQ0Q28 B42A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=fjrEpJ2fhUjux5ecC0FdGKxJc5Idjg81vPSBppBZbMQ=; b=AZLnfNhfrQFrTZq/ZLBvZAVtCBeIbYp4z6JmLzHhlI3mSSOs9Y3xpD1tya4Voej+Sa phNBeZP92sL0IVRnav3NFjbD1GBrOMJhmD3WFrEVT/8iN0fbU/GBaQaRedEjoPpEyLUR Qh//iuI2Rb7ND+3B29fuiHONmPJ8iLGE1iOEtOhBFhuz4u+i/BT3bs5l8fdpzlvhwPV+ THzD2ucyqPL1s9gchoVxhKnN5fRYknPoqrvoVCIOKnFrZEncta9Kcj2ZlPItKV0kOvGZ EixJqz6eQJyBJrjOdS27N8YGOJEb83Ko06q7h7x3WktscJB957+RMQEMNdAdcLjYeWfb goFg== X-Gm-Message-State: APjAAAUAqnPtVTYKw+/e8tLLjQytrKfNKeIvGxOM3J/B0mTK4BLjfwQa a2sCyhWziLue3hc1b5N8rH/77dyD X-Google-Smtp-Source: APXvYqznZTtzz4YXIuovrZbcOfr0aVQA66egpRA9mhDcldwxGLQsxhlNOnzuL/8jeVhoXWWGzTh6Sg== X-Received: by 2002:adf:814d:: with SMTP id 71mr10066841wrm.193.1570732610481; Thu, 10 Oct 2019 11:36:50 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y5sm6809694wma.14.2019.10.10.11.36.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Oct 2019 11:36:50 -0700 (PDT) Date: Thu, 10 Oct 2019 11:36:50 -0700 (PDT) X-Google-Original-Date: Thu, 10 Oct 2019 18:36:46 GMT Message-Id: <7305f8d8e81b856ba535aaafe97c708d80567566.1570732608.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Phillip Wood via GitGitGadget" Subject: [PATCH 1/3] sequencer.h fix placement of #endif Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Junio C Hamano , Phillip Wood Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Phillip Wood Commit 65850686cf ("rebase -i: rewrite write_basic_state() in C", 2018-08-28) accidentially added new function declarations after the #endif at the end of the include guard. Signed-off-by: Phillip Wood --- sequencer.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sequencer.h b/sequencer.h index 0c494b83d4..ac66892d71 100644 --- a/sequencer.h +++ b/sequencer.h @@ -195,11 +195,10 @@ void print_commit_summary(struct repository *repo, int read_author_script(const char *path, char **name, char **email, char **date, int allow_missing); -#endif - void parse_strategy_opts(struct replay_opts *opts, char *raw_opts); int write_basic_state(struct replay_opts *opts, const char *head_name, struct commit *onto, const char *orig_head); void sequencer_post_commit_cleanup(struct repository *r); int sequencer_get_last_command(struct repository* r, enum replay_action *action); +#endif /* SEQUENCER_H */ From patchwork Thu Oct 10 18:36:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koji Nakamaru via GitGitGadget X-Patchwork-Id: 11184061 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 58ACE17EE for ; Thu, 10 Oct 2019 18:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A3FD214E0 for ; Thu, 10 Oct 2019 18:36:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dd8RsJNs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbfJJSgx (ORCPT ); Thu, 10 Oct 2019 14:36:53 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:52303 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726793AbfJJSgx (ORCPT ); Thu, 10 Oct 2019 14:36:53 -0400 Received: by mail-wm1-f65.google.com with SMTP id r19so7994787wmh.2 for ; Thu, 10 Oct 2019 11:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=FIgFkf3vQsjO6QJAlf6Dl+CB3wuo1U1NElt8epvcWNI=; b=dd8RsJNslzcbBQ0I9Kn3E63Bg8PQ9iL6jlVhfJErj+piaiQm4chITHpt0xFNabBoix P+LOtzwRwsCzzSe7iWmbEX4xWwXGLjnN0aouaVR4H0rgXnTLsgm1sgKfW8RLpXn0ymWY sqgzE1QB8XZtQBD0JgII5sTPUi8MSbPnq7n9q+SVdKL4nbWB4iOdGYFVKbOSyojujJFm OpxujHLI78XlwooXnZcUGb+M6p4667WKlGRhwLS8e4NAz4NwCgwhqZuJqgLpjc7Vh7Eq KQTwMv9I10rYlenXElNWjVcHXzq56t6RdtXqB1j/WrlNf+Aelefu/AZEWjjfA1OgloPq ZD+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=FIgFkf3vQsjO6QJAlf6Dl+CB3wuo1U1NElt8epvcWNI=; b=CN4wkEM9fGJFoHUZg8zYpG5oEqaXqbI/yjsi3HdQzegIqYWewrkWXRzhPRCJ8iZv3H PbWAfnHuzMJFJ7o6A4ynoDKgNHK2634hoNjGqAUuu4oVrpvGhHPfc1LesSC+E/ao1e9x HlDmBdXnnoJcAAwCN3RH/AD4TpinU0YL5+NtqB1iNsSc/IKj/UH+ZccHB4exe8AtW1ah NHM2a0Po1rtxrqFA53e4JI3on41yoJCgJdnVNakF5jAk1otzG4wi4unNgkkM8G2yv5lc f8RGahHMpAU46oBs+0qP3gT/hwXq0gO37HCt5Rxv82k/u6MSbIDtL8khYvEyTlGd/bGP SHqw== X-Gm-Message-State: APjAAAWAbhpbnGhGMkKaumHbUNcw2fb2ePhxoMw1a+wzMP0sNJ79EWfq I6Ys30rfHPPnPuhZZ94LrxUkVGlQ X-Google-Smtp-Source: APXvYqxD2K5sf7ZL+HBVzZceOq8CvP8I5Ltv62r6BUnLfN3As+rppWCAp4Pp5rolM+WTKubXt0LuSg== X-Received: by 2002:a7b:c947:: with SMTP id i7mr8901807wml.53.1570732611268; Thu, 10 Oct 2019 11:36:51 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z22sm6379769wmf.2.2019.10.10.11.36.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Oct 2019 11:36:50 -0700 (PDT) Date: Thu, 10 Oct 2019 11:36:50 -0700 (PDT) X-Google-Original-Date: Thu, 10 Oct 2019 18:36:47 GMT Message-Id: <420ecf442c729878da5219f3c718dd136e4fa2b4.1570732608.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Phillip Wood via GitGitGadget" Subject: [PATCH 2/3] sequencer: use run_commit_hook() Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Junio C Hamano , Phillip Wood Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Phillip Wood This simplifies the implementation of run_prepare_commit_msg_hook() and will be used in the next commit. Signed-off-by: Phillip Wood --- builtin/commit.c | 22 ---------------------- commit.h | 3 --- sequencer.c | 45 ++++++++++++++++++++++++++++++++++----------- sequencer.h | 2 ++ 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/builtin/commit.c b/builtin/commit.c index 1921401117..d898a57f5d 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1443,28 +1443,6 @@ static int git_commit_config(const char *k, const char *v, void *cb) return git_status_config(k, v, s); } -int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...) -{ - struct argv_array hook_env = ARGV_ARRAY_INIT; - va_list args; - int ret; - - argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", index_file); - - /* - * Let the hook know that no editor will be launched. - */ - if (!editor_is_used) - argv_array_push(&hook_env, "GIT_EDITOR=:"); - - va_start(args, name); - ret = run_hook_ve(hook_env.argv,name, args); - va_end(args); - argv_array_clear(&hook_env); - - return ret; -} - int cmd_commit(int argc, const char **argv, const char *prefix) { const char *argv_gc_auto[] = {"gc", "--auto", NULL}; diff --git a/commit.h b/commit.h index f5295ca7f3..37684a35f0 100644 --- a/commit.h +++ b/commit.h @@ -389,7 +389,4 @@ void verify_merge_signature(struct commit *commit, int verbose); int compare_commits_by_commit_date(const void *a_, const void *b_, void *unused); int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void *unused); -LAST_ARG_MUST_BE_NULL -int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...); - #endif /* COMMIT_H */ diff --git a/sequencer.c b/sequencer.c index 2adcf5a639..3ce578c40b 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1123,28 +1123,51 @@ void commit_post_rewrite(struct repository *r, run_rewrite_hook(&old_head->object.oid, new_head); } +int run_commit_hook(int editor_is_used, const char *index_file, + const char *name, ...) +{ + struct argv_array hook_env = ARGV_ARRAY_INIT; + va_list args; + int ret; + + argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", index_file); + + /* + * Let the hook know that no editor will be launched. + */ + if (!editor_is_used) + argv_array_push(&hook_env, "GIT_EDITOR=:"); + + va_start(args, name); + ret = run_hook_ve(hook_env.argv,name, args); + va_end(args); + argv_array_clear(&hook_env); + + return ret; +} + static int run_prepare_commit_msg_hook(struct repository *r, struct strbuf *msg, const char *commit) { struct argv_array hook_env = ARGV_ARRAY_INIT; - int ret; - const char *name; + int ret = 0; + const char *name, *arg1 = NULL, *arg2 = NULL; name = git_path_commit_editmsg(); if (write_message(msg->buf, msg->len, name, 0)) return -1; - argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", r->index_file); - argv_array_push(&hook_env, "GIT_EDITOR=:"); - if (commit) - ret = run_hook_le(hook_env.argv, "prepare-commit-msg", name, - "commit", commit, NULL); - else - ret = run_hook_le(hook_env.argv, "prepare-commit-msg", name, - "message", NULL); - if (ret) + if (commit) { + arg1 = "commit"; + arg2 = commit; + } else { + arg1 = "message"; + } + if (run_commit_hook(0, r->index_file, "prepare-commit-msg", name, + arg1, arg2, NULL)) ret = error(_("'prepare-commit-msg' hook failed")); + argv_array_clear(&hook_env); return ret; diff --git a/sequencer.h b/sequencer.h index ac66892d71..b0419d6ddb 100644 --- a/sequencer.h +++ b/sequencer.h @@ -201,4 +201,6 @@ int write_basic_state(struct replay_opts *opts, const char *head_name, void sequencer_post_commit_cleanup(struct repository *r); int sequencer_get_last_command(struct repository* r, enum replay_action *action); +LAST_ARG_MUST_BE_NULL +int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...); #endif /* SEQUENCER_H */ From patchwork Thu Oct 10 18:36:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koji Nakamaru via GitGitGadget X-Patchwork-Id: 11184065 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D437A14DB for ; Thu, 10 Oct 2019 18:36:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B720F214E0 for ; Thu, 10 Oct 2019 18:36:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j2N8qZmG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726888AbfJJSgz (ORCPT ); Thu, 10 Oct 2019 14:36:55 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:46798 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbfJJSgy (ORCPT ); Thu, 10 Oct 2019 14:36:54 -0400 Received: by mail-wr1-f65.google.com with SMTP id o18so9056478wrv.13 for ; Thu, 10 Oct 2019 11:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=IQ2YZVQ/e77LXAgecQhkYAlY0rP6/v+Grw4mfX/8IIA=; b=j2N8qZmGD8JGiiknzL41eGo9k117Kuqmf2eN0H8X7CxAxq9LV+P4wiEdUYkNt5uQJJ jENUrZkwwaixIvRd+q9n8fZiUBZPMvHMP8VV7td1XKKRtvTBm3Px6r5ihF5I5ijL83Qi 9YCwfsXk9P+9o0wLhkiq/5jubNikIPXyAvskKz/oNIUM2Rn9ARKTH/pVVQG4Ow2GT0GB PqumqobCL3Dk+LszTUl8/qveJ73BgLhGTh9HTqTzeuU/SxUimMTeV7ArQrYCSrFbS9jE yan7mIvQ2KZFlxIoKOLbxcQYegq+ZobhXqHx0/zyDVFsRrT1sH2LT6fM+wkkgxi5ZdFI mnnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=IQ2YZVQ/e77LXAgecQhkYAlY0rP6/v+Grw4mfX/8IIA=; b=D4elyWsn15NKajKzrMNAIK2yJ9R7NmnlbIxa7UCBVrtJj+V1vK+eKCcPKGlmBPOtzj T/jpxG6U7sP7q0DlQWMy3qLQFssrCVCzc3XzqfzLwxsvQSC6qXqi+qVM3BDoPTLP/iZ5 Ils5oJPnjbgj4YEH0L1PnMQCoAeM3bzTC+vyDLinzCOUozZMSGBoLGPKqFo3d4d6Jn2P J6F7MoxJgLW3a/EXq7/IRLPUu8jAFV7d7av/br8Dn/XE/D5E85MbSej4aLtIm6i/xtCj WjoLUUxwn3T7HSGNooyZuSx4aVaQ9+7rwbgClZVR31B9gl1qOkQb2CxwrSuqnfsM72AI C5Xg== X-Gm-Message-State: APjAAAWa5C5kpjGT0AAUhZ92GKMWLrzkjfTt1Knk+sZgirml2v2YxOl5 SIXhZJJhhJJsdTaR3JDnF7a+rXpq X-Google-Smtp-Source: APXvYqzke9/6VJ6JLIUYwn708TXmfnIjNnjtGizWCCQkzGc2Iao5tBsWnFo62TL+HIl4PYTU62JKFg== X-Received: by 2002:adf:fe8b:: with SMTP id l11mr9697476wrr.167.1570732612035; Thu, 10 Oct 2019 11:36:52 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n17sm6748245wrp.37.2019.10.10.11.36.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Oct 2019 11:36:51 -0700 (PDT) Date: Thu, 10 Oct 2019 11:36:51 -0700 (PDT) X-Google-Original-Date: Thu, 10 Oct 2019 18:36:48 GMT Message-Id: In-Reply-To: References: From: "Phillip Wood via GitGitGadget" Subject: [PATCH 3/3] sequencer: run post-commit hook Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Junio C Hamano , Phillip Wood Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Phillip Wood Prior to commit 356ee4659b ("sequencer: try to commit without forking 'git commit'", 2017-11-24) the sequencer would always run the post-commit hook after each pick or revert as it forked `git commit` to create the commit. The conversion to committing without forking `git commit` omitted to call the post-commit hook after creating the commit. Signed-off-by: Phillip Wood --- builtin/commit.c | 2 +- sequencer.c | 5 +++++ sequencer.h | 1 + t/t3404-rebase-interactive.sh | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/builtin/commit.c b/builtin/commit.c index d898a57f5d..adb8c89c60 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1653,7 +1653,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) repo_rerere(the_repository, 0); run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); - run_commit_hook(use_editor, get_index_file(), "post-commit", NULL); + run_post_commit_hook(use_editor, get_index_file()); if (amend && !no_post_rewrite) { commit_post_rewrite(the_repository, current_head, &oid); } diff --git a/sequencer.c b/sequencer.c index 3ce578c40b..b4947f6969 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1173,6 +1173,10 @@ static int run_prepare_commit_msg_hook(struct repository *r, return ret; } +void run_post_commit_hook(int editor_is_used, const char *index_file) { + run_commit_hook(editor_is_used, index_file, "post-commit", NULL); +} + static const char implicit_ident_advice_noconfig[] = N_("Your name and email address were configured automatically based\n" "on your username and hostname. Please check that they are accurate.\n" @@ -1427,6 +1431,7 @@ static int try_to_commit(struct repository *r, goto out; } + run_post_commit_hook(0, r->index_file); if (flags & AMEND_MSG) commit_post_rewrite(r, current_head, oid); diff --git a/sequencer.h b/sequencer.h index b0419d6ddb..e3e73c5635 100644 --- a/sequencer.h +++ b/sequencer.h @@ -203,4 +203,5 @@ int sequencer_get_last_command(struct repository* r, enum replay_action *action); LAST_ARG_MUST_BE_NULL int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...); +void run_post_commit_hook(int editor_is_used, const char *index_file); #endif /* SEQUENCER_H */ diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index d2f1d5bd23..d9217235b6 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -1467,4 +1467,21 @@ test_expect_success 'valid author header when author contains single quote' ' test_cmp expected actual ' +test_expect_success 'post-commit hook is called' ' + test_when_finished "rm -f .git/hooks/post-commit commits" && + mkdir -p .git/hooks && + write_script .git/hooks/post-commit <<-\EOS && + git rev-parse HEAD >>commits + EOS + set_fake_editor && + FAKE_LINES="edit 4 1 reword 2 fixup 3" git rebase -i A E && + echo x>file3 && + git add file3 && + FAKE_COMMIT_MESSAGE=edited git rebase --continue && + # rev-list does not support -g --reverse + git rev-list --no-walk=unsorted HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} \ + HEAD@{1} HEAD >expected && + test_cmp expected commits +' + test_done