From 9d6b9df128f842d2945e20e0760489ec6f3d2c0c Mon Sep 17 00:00:00 2001 From: Phillip Wood Date: Tue, 2 Nov 2021 21:30:51 +0000 Subject: rebase -i: fix rewording with --committer-date-is-author-date baf8ec8d3a (rebase -r: don't write .git/MERGE_MSG when fast-forwarding, 2021-08-20) stopped reading the author script in run_git_commit() when rewording a commit. This is normally safe because "git commit --amend" preserves the authorship. However if the user passes "--committer-date-is-author-date" then we need to read the author date from the author script when rewording. Fix this regression by tightening the check for when it is safe to skip reading the author script. Reported-by: Jonas Kittner Signed-off-by: Phillip Wood Signed-off-by: Junio C Hamano --- sequencer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sequencer.c') diff --git a/sequencer.c b/sequencer.c index a19980f62d..6592eff117 100644 --- a/sequencer.c +++ b/sequencer.c @@ -983,7 +983,9 @@ static int run_git_commit(const char *defmsg, cmd.git_cmd = 1; - if (is_rebase_i(opts) && !(!defmsg && (flags & AMEND_MSG)) && + if (is_rebase_i(opts) && + ((opts->committer_date_is_author_date && !opts->ignore_date) || + !(!defmsg && (flags & AMEND_MSG))) && read_env_script(&cmd.env_array)) { const char *gpg_opt = gpg_sign_opt_quoted(opts); -- cgit v1.2.3