зеркало из https://github.com/microsoft/git.git
Merge branch 'always-reword-merge-c'
During a `rebase -r`, when a `merge -c` is executed that can fast-forward, we *still* want to edit the commit message. Let's force this *not* to fast-forward instead. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Коммит
57e2b1eb0a
|
@ -3401,6 +3401,10 @@ static int do_merge(struct repository *r,
|
||||||
rollback_lock_file(&lock);
|
rollback_lock_file(&lock);
|
||||||
ret = fast_forward_to(r, &commit->object.oid,
|
ret = fast_forward_to(r, &commit->object.oid,
|
||||||
&head_commit->object.oid, 0, opts);
|
&head_commit->object.oid, 0, opts);
|
||||||
|
if (flags & TODO_EDIT_MERGE_MSG) {
|
||||||
|
run_commit_flags |= AMEND_MSG;
|
||||||
|
goto fast_forward_edit;
|
||||||
|
}
|
||||||
goto leave_merge;
|
goto leave_merge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3504,6 +3508,7 @@ static int do_merge(struct repository *r,
|
||||||
* value (a negative one would indicate that the `merge`
|
* value (a negative one would indicate that the `merge`
|
||||||
* command needs to be rescheduled).
|
* command needs to be rescheduled).
|
||||||
*/
|
*/
|
||||||
|
fast_forward_edit:
|
||||||
ret = !!run_git_commit(r, git_path_merge_msg(r), opts,
|
ret = !!run_git_commit(r, git_path_merge_msg(r), opts,
|
||||||
run_commit_flags);
|
run_commit_flags);
|
||||||
|
|
||||||
|
|
|
@ -164,6 +164,19 @@ test_expect_success 'failed `merge <branch>` does not crash' '
|
||||||
grep "^Merge branch ${SQ}G${SQ}$" .git/rebase-merge/message
|
grep "^Merge branch ${SQ}G${SQ}$" .git/rebase-merge/message
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'fast-forward merge -c still rewords' '
|
||||||
|
git checkout -b fast-forward-merge-c H &&
|
||||||
|
(
|
||||||
|
set_fake_editor &&
|
||||||
|
FAKE_COMMIT_MESSAGE=edited \
|
||||||
|
GIT_SEQUENCE_EDITOR="echo merge -c H G >" \
|
||||||
|
git rebase -ir @^
|
||||||
|
) &&
|
||||||
|
echo edited >expected &&
|
||||||
|
git log --pretty=format:%B -1 >actual &&
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'with a branch tip that was cherry-picked already' '
|
test_expect_success 'with a branch tip that was cherry-picked already' '
|
||||||
git checkout -b already-upstream master &&
|
git checkout -b already-upstream master &&
|
||||||
base="$(git rev-parse --verify HEAD)" &&
|
base="$(git rev-parse --verify HEAD)" &&
|
||||||
|
|
Загрузка…
Ссылка в новой задаче