Skip to content

Commit ecb8d9d

Browse files
committed
Merge branch 'pw/rebase-r-fixes' into maint
Regression fix. * pw/rebase-r-fixes: rebase -i: fix rewording with --committer-date-is-author-date
2 parents 99c7db5 + 9d6b9df commit ecb8d9d

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

sequencer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,9 @@ static int run_git_commit(const char *defmsg,
983983

984984
cmd.git_cmd = 1;
985985

986-
if (is_rebase_i(opts) && !(!defmsg && (flags & AMEND_MSG)) &&
986+
if (is_rebase_i(opts) &&
987+
((opts->committer_date_is_author_date && !opts->ignore_date) ||
988+
!(!defmsg && (flags & AMEND_MSG))) &&
987989
read_env_script(&cmd.env_array)) {
988990
const char *gpg_opt = gpg_sign_opt_quoted(opts);
989991

t/t3436-rebase-more-options.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ test_expect_success '--committer-date-is-author-date works with merge backend' '
8282
test_ctime_is_atime -1
8383
'
8484

85+
test_expect_success '--committer-date-is-author-date works when rewording' '
86+
GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author &&
87+
(
88+
set_fake_editor &&
89+
FAKE_COMMIT_MESSAGE=edited \
90+
FAKE_LINES="reword 1" \
91+
git rebase -i --committer-date-is-author-date HEAD^
92+
) &&
93+
test_write_lines edited "" >expect &&
94+
git log --format="%B" -1 >actual &&
95+
test_cmp expect actual &&
96+
test_ctime_is_atime -1
97+
'
98+
8599
test_expect_success '--committer-date-is-author-date works with rebase -r' '
86100
git checkout side &&
87101
GIT_AUTHOR_DATE="@1234 +0300" git merge --no-ff commit3 &&
@@ -155,6 +169,21 @@ test_expect_success '--reset-author-date with --committer-date-is-author-date wo
155169
test_atime_is_ignored -2
156170
'
157171

172+
test_expect_success 'reset-author-date with --committer-date-is-author-date works when rewording' '
173+
GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author &&
174+
(
175+
set_fake_editor &&
176+
FAKE_COMMIT_MESSAGE=edited \
177+
FAKE_LINES="reword 1" \
178+
git rebase -i --committer-date-is-author-date \
179+
--reset-author-date HEAD^
180+
) &&
181+
test_write_lines edited "" >expect &&
182+
git log --format="%B" -1 >actual &&
183+
test_cmp expect actual &&
184+
test_atime_is_ignored -1
185+
'
186+
158187
test_expect_success '--reset-author-date --committer-date-is-author-date works when forking merge' '
159188
GIT_SEQUENCE_EDITOR="echo \"merge -C $(git rev-parse HEAD) commit3\">" \
160189
PATH="./test-bin:$PATH" git rebase -i --strategy=test \

0 commit comments

Comments
 (0)