rebase: fix broken email with --committer-date-is-author-date

Commit 7573cec52c (rebase -i: support --committer-date-is-author-date, 2020-08-17) copied the committer ident-parsing code from builtin/am.c. And in doing so, it copied a bug in which we always set the email to an empty string. We fixed the version in git-am in the previous commit; this commit fixes the copied code. Reported-by: VenomVendor <info@venomvendor.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 23, 2020 at 03:10 UTC 5f35edd9d7ebca17f205b338d340cc6ce214644a
2 files changed +5 -5
sequencer.c
+1 -1
@@ -4369,7 +4369,7 @@ static int init_committer(struct replay_opts *opts)
4369 opts->committer_name =
4370 xmemdupz(id.name_begin, id.name_end - id.name_begin);
4371 opts->committer_email =
4372 - xmemdupz(id.mail_begin, id.mail_end - id.mail_end);
4372 + xmemdupz(id.mail_begin, id.mail_end - id.mail_begin);
4373
4374 return 0;
4375 }
t/t3436-rebase-more-options.sh
+4 -4
@@ -76,20 +76,20 @@ test_expect_success '--committer-date-is-author-date works with apply backend' '
76 test_ctime_is_atime -1
77 '
78
79 -test_expect_failure '--committer-date-is-author-date works with merge backend' '
79 +test_expect_success '--committer-date-is-author-date works with merge backend' '
80 GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author &&
81 git rebase -m --committer-date-is-author-date HEAD^ &&
82 test_ctime_is_atime -1
83 '
84
85 -test_expect_failure '--committer-date-is-author-date works with rebase -r' '
85 +test_expect_success '--committer-date-is-author-date works with rebase -r' '
86 git checkout side &&
87 GIT_AUTHOR_DATE="@1234 +0300" git merge --no-ff commit3 &&
88 git rebase -r --root --committer-date-is-author-date &&
89 test_ctime_is_atime
90 '
91
92 -test_expect_failure '--committer-date-is-author-date works when forking merge' '
92 +test_expect_success '--committer-date-is-author-date works when forking merge' '
93 git checkout side &&
94 GIT_AUTHOR_DATE="@1234 +0300" git merge --no-ff commit3 &&
95 PATH="./test-bin:$PATH" git rebase -r --root --strategy=test \
@@ -145,7 +145,7 @@ test_expect_success '--reset-author-date works with rebase -r' '
145 test_atime_is_ignored
146 '
147
148 -test_expect_failure '--reset-author-date with --committer-date-is-author-date works' '
148 +test_expect_success '--reset-author-date with --committer-date-is-author-date works' '
149 test_must_fail git rebase -m --committer-date-is-author-date \
150 --reset-author-date --onto commit2^^ commit2^ commit3 &&
151 git checkout --theirs foo &&