From: Junio C Hamano Date: Fri, 27 Apr 2012 20:59:20 +0000 (-0700) Subject: Merge branch 'jc/merge-reduce-parents-early' X-Git-Tag: v1.7.11-rc0~92 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=283097e9ed751b866c9d405d17c21a10bfb9465f;p=git.git Merge branch 'jc/merge-reduce-parents-early' Octopus merge strategy did not reduce heads that are recorded in the final commit correctly. By Junio C Hamano (4) and MichaƂ Kiedrowicz (1) * jc/merge-reduce-parents-early: fmt-merge-msg: discard needless merge parents builtin/merge.c: reduce parents early builtin/merge.c: collect other parents early builtin/merge.c: remove "remoteheads" global variable merge tests: octopus with redundant parents --- 283097e9ed751b866c9d405d17c21a10bfb9465f diff --cc builtin/merge.c index 08e01e8a6,20aeca0b3..470fc57c5 --- a/builtin/merge.c +++ b/builtin/merge.c @@@ -905,14 -904,14 +906,14 @@@ static void prepare_to_commit(struct co write_merge_msg(&msg); run_hook(get_index_file(), "prepare-commit-msg", git_path("MERGE_MSG"), "merge", NULL, NULL); - if (option_edit) { + if (0 < option_edit) { if (launch_editor(git_path("MERGE_MSG"), NULL, NULL)) - abort_commit(NULL); + abort_commit(remoteheads, NULL); } read_merge_msg(&msg); - stripspace(&msg, option_edit); + stripspace(&msg, 0 < option_edit); if (!msg.len) - abort_commit(_("Empty commit message.")); + abort_commit(remoteheads, _("Empty commit message.")); strbuf_release(&merge_msg); strbuf_addbuf(&merge_msg, &msg); strbuf_release(&msg); @@@ -1330,10 -1356,13 +1356,12 @@@ int cmd_merge(int argc, const char **ar } if (option_edit < 0) - option_edit = 0; + option_edit = default_edit_option(); if (!use_strategies) { - if (!remoteheads->next) + if (!remoteheads) + ; /* already up-to-date */ + else if (!remoteheads->next) add_strategies(pull_twohead, DEFAULT_TWOHEAD); else add_strategies(pull_octopus, DEFAULT_OCTOPUS); diff --cc t/t7602-merge-octopus-many.sh index bce0bd37c,7117b57cc..3b72c097e --- a/t/t7602-merge-octopus-many.sh +++ b/t/t7602-merge-octopus-many.sh @@@ -78,9 -76,9 +76,9 @@@ Merge made by the 'recursive' strategy create mode 100644 c5.c EOF - test_expect_success 'merge up-to-date output uses pretty names' ' - git merge c4 c5 >actual && + test_expect_success 'merge reduces irrelevant remote heads' ' + GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual && - test_cmp expected actual + test_i18ncmp expected actual ' cat >expected <<\EOF