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>
This commit is contained in:
parent
16b0bb99ea
commit
5f35edd9d7
@ -4369,7 +4369,7 @@ static int init_committer(struct replay_opts *opts)
|
|||||||
opts->committer_name =
|
opts->committer_name =
|
||||||
xmemdupz(id.name_begin, id.name_end - id.name_begin);
|
xmemdupz(id.name_begin, id.name_end - id.name_begin);
|
||||||
opts->committer_email =
|
opts->committer_email =
|
||||||
xmemdupz(id.mail_begin, id.mail_end - id.mail_end);
|
xmemdupz(id.mail_begin, id.mail_end - id.mail_begin);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -76,20 +76,20 @@ test_expect_success '--committer-date-is-author-date works with apply backend' '
|
|||||||
test_ctime_is_atime -1
|
test_ctime_is_atime -1
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure '--committer-date-is-author-date works with merge backend' '
|
test_expect_success '--committer-date-is-author-date works with merge backend' '
|
||||||
GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author &&
|
GIT_AUTHOR_DATE="@1234 +0300" git commit --amend --reset-author &&
|
||||||
git rebase -m --committer-date-is-author-date HEAD^ &&
|
git rebase -m --committer-date-is-author-date HEAD^ &&
|
||||||
test_ctime_is_atime -1
|
test_ctime_is_atime -1
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure '--committer-date-is-author-date works with rebase -r' '
|
test_expect_success '--committer-date-is-author-date works with rebase -r' '
|
||||||
git checkout side &&
|
git checkout side &&
|
||||||
GIT_AUTHOR_DATE="@1234 +0300" git merge --no-ff commit3 &&
|
GIT_AUTHOR_DATE="@1234 +0300" git merge --no-ff commit3 &&
|
||||||
git rebase -r --root --committer-date-is-author-date &&
|
git rebase -r --root --committer-date-is-author-date &&
|
||||||
test_ctime_is_atime
|
test_ctime_is_atime
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure '--committer-date-is-author-date works when forking merge' '
|
test_expect_success '--committer-date-is-author-date works when forking merge' '
|
||||||
git checkout side &&
|
git checkout side &&
|
||||||
GIT_AUTHOR_DATE="@1234 +0300" git merge --no-ff commit3 &&
|
GIT_AUTHOR_DATE="@1234 +0300" git merge --no-ff commit3 &&
|
||||||
PATH="./test-bin:$PATH" git rebase -r --root --strategy=test \
|
PATH="./test-bin:$PATH" git rebase -r --root --strategy=test \
|
||||||
@ -145,7 +145,7 @@ test_expect_success '--reset-author-date works with rebase -r' '
|
|||||||
test_atime_is_ignored
|
test_atime_is_ignored
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure '--reset-author-date with --committer-date-is-author-date works' '
|
test_expect_success '--reset-author-date with --committer-date-is-author-date works' '
|
||||||
test_must_fail git rebase -m --committer-date-is-author-date \
|
test_must_fail git rebase -m --committer-date-is-author-date \
|
||||||
--reset-author-date --onto commit2^^ commit2^ commit3 &&
|
--reset-author-date --onto commit2^^ commit2^ commit3 &&
|
||||||
git checkout --theirs foo &&
|
git checkout --theirs foo &&
|
||||||
|
Loading…
Reference in New Issue
Block a user