From 7ccdf65b63f2f4a5e751d70b9788af3c9e16b6ab Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 25 Apr 2018 14:29:31 +0200 Subject: rebase --rebase-merges: avoid "empty merges" The `git merge` command does not allow merging commits that are already reachable from HEAD: `git merge HEAD^`, for example, will report that we are already up to date and not change a thing. In an interactive rebase, such a merge could occur previously, e.g. when competing (or slightly modified) versions of a patch series were applied upstream, and the user had to `git rebase --skip` all of the local commits, and the topic branch becomes "empty" as a consequence. Let's teach the todo command `merge` to behave the same as `git merge`. Seeing as it requires some low-level trickery to create such merges with Git's commands in the first place, we do not even have to bother to introduce an option to force `merge` to create such merge commits. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3430-rebase-merges.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/t3430-rebase-merges.sh') diff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh index e9c5dc1cd9..1628c8dcc2 100755 --- a/t/t3430-rebase-merges.sh +++ b/t/t3430-rebase-merges.sh @@ -215,4 +215,12 @@ test_expect_success 'post-rewrite hook and fixups work for merges' ' test_cmp expect actual ' +test_expect_success 'refuse to merge ancestors of HEAD' ' + echo "merge HEAD^" >script-from-scratch && + test_config -C wt sequence.editor \""$PWD"/replace-editor.sh\" && + before="$(git rev-parse HEAD)" && + git rebase -i HEAD && + test_cmp_rev HEAD $before +' + test_done -- cgit v1.2.3