summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-11-04 19:20:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-11-04 19:20:14 (GMT)
commitecb8d9d11ed97619f17e2c98d49409aa8127653f (patch)
tree6907e165461733c77a40ac1dc85f4ea0f59dbdc2
parent99c7db563fb12b053aaa2b4d7556f979c4883ea1 (diff)
parent9d6b9df128f842d2945e20e0760489ec6f3d2c0c (diff)
downloadgit-ecb8d9d11ed97619f17e2c98d49409aa8127653f.zip
git-ecb8d9d11ed97619f17e2c98d49409aa8127653f.tar.gz
git-ecb8d9d11ed97619f17e2c98d49409aa8127653f.tar.bz2
Merge branch 'pw/rebase-r-fixes' into maint
Regression fix. * pw/rebase-r-fixes: rebase -i: fix rewording with --committer-date-is-author-date
-rw-r--r--sequencer.c4
-rwxr-xr-xt/t3436-rebase-more-options.sh29
2 files changed, 32 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c
index e4627d9..5c705f2 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);
diff --git a/t/t3436-rebase-more-options.sh b/t/t3436-rebase-more-options.sh
index 4d10664..94671d3 100755
--- a/t/t3436-rebase-more-options.sh
+++ b/t/t3436-rebase-more-options.sh
@@ -82,6 +82,20 @@ test_expect_success '--committer-date-is-author-date works with merge backend' '
test_ctime_is_atime -1
'
+test_expect_success '--committer-date-is-author-date works when rewording' '
+ GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author &&
+ (
+ set_fake_editor &&
+ FAKE_COMMIT_MESSAGE=edited \
+ FAKE_LINES="reword 1" \
+ git rebase -i --committer-date-is-author-date HEAD^
+ ) &&
+ test_write_lines edited "" >expect &&
+ git log --format="%B" -1 >actual &&
+ test_cmp expect actual &&
+ test_ctime_is_atime -1
+'
+
test_expect_success '--committer-date-is-author-date works with rebase -r' '
git checkout side &&
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
test_atime_is_ignored -2
'
+test_expect_success 'reset-author-date with --committer-date-is-author-date works when rewording' '
+ GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author &&
+ (
+ set_fake_editor &&
+ FAKE_COMMIT_MESSAGE=edited \
+ FAKE_LINES="reword 1" \
+ git rebase -i --committer-date-is-author-date \
+ --reset-author-date HEAD^
+ ) &&
+ test_write_lines edited "" >expect &&
+ git log --format="%B" -1 >actual &&
+ test_cmp expect actual &&
+ test_atime_is_ignored -1
+'
+
test_expect_success '--reset-author-date --committer-date-is-author-date works when forking merge' '
GIT_SEQUENCE_EDITOR="echo \"merge -C $(git rev-parse HEAD) commit3\">" \
PATH="./test-bin:$PATH" git rebase -i --strategy=test \