{"thread":{"id":"39147","subject":"[PATCH] merge: simplify code flow","startedAt":"2015-04-23T20:01:44Z","lastAt":"2015-04-23T20:15:07Z","messageCount":3,"participants":["Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"259912","messageId":"xmqqh9s6397b.fsf@gitster.dls.corp.google.com","threadId":"39147","inReplyTo":null,"subject":"[PATCH] merge: simplify code flow","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-04-23T20:01:44Z","receivedAt":"2015-04-23T20:01:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"One of the first things cmd_merge() does is to see if the \"--abort\"\noption is given and run \"reset --merge\" and exit.  When the control\nreaches this point, we know \"--abort\" was not given.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/merge.c | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 3b0f8f9..0ab7142 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1158,15 +1158,15 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\toption_commit = 0;\n \t}\n \n-\tif (!abort_current_merge) {\n-\t\tif (!argc) {\n-\t\t\tif (default_to_upstream)\n-\t\t\t\targc = setup_with_upstream(&argv);\n-\t\t\telse\n-\t\t\t\tdie(_(\"No commit specified and merge.defaultToUpstream not set.\"));\n-\t\t} else if (argc == 1 && !strcmp(argv[0], \"-\"))\n-\t\t\targv[0] = \"@{-1}\";\n+\tif (!argc) {\n+\t\tif (default_to_upstream)\n+\t\t\targc = setup_with_upstream(&argv);\n+\t\telse\n+\t\t\tdie(_(\"No commit specified and merge.defaultToUpstream not set.\"));\n+\t} else if (argc == 1 && !strcmp(argv[0], \"-\")) {\n+\t\targv[0] = \"@{-1}\";\n \t}\n+\n \tif (!argc)\n \t\tusage_with_options(builtin_merge_usage,\n \t\t\tbuiltin_merge_options);\n"},{"id":"259913","messageId":"20150423201019.GA28338@peff.net","threadId":"39147","inReplyTo":"xmqqh9s6397b.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] merge: simplify code flow","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-04-23T20:10:19Z","receivedAt":"2015-04-23T20:10:19Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Apr 23, 2015 at 01:01:44PM -0700, Junio C Hamano wrote:\n\n> One of the first things cmd_merge() does is to see if the \"--abort\"\n> option is given and run \"reset --merge\" and exit.  When the control\n> reaches this point, we know \"--abort\" was not given.\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nYeah, this looks obviously correct.\n\nAs an aside, the fact that the actual \"if (abort_current_merge)\"\nconditional ends with a \"goto\" to a cleanup label that is 500 lines away\nis...kind of gross.\n\n-Peff\n"},{"id":"259914","messageId":"xmqqd22u38l0.fsf@gitster.dls.corp.google.com","threadId":"39147","inReplyTo":"20150423201019.GA28338@peff.net","subject":"Re: [PATCH] merge: simplify code flow","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-04-23T20:15:07Z","receivedAt":"2015-04-23T20:15:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Yeah, this looks obviously correct.\n\nIt is funny that this dates back to the very beginning of defaulting\nto the upstream, the code that \"if ()\" block implements, introduced\nat 93e535a5 (merge: merge with the default upstream branch without\nargument, 2011-03-23).\n\n> As an aside, the fact that the actual \"if (abort_current_merge)\"\n> conditional ends with a \"goto\" to a cleanup label that is 500 lines away\n> is...kind of gross.\n\nReading \"git show 93e535a5\" output, I see that it is a more recent\n\"breakage\" ;-)\n"}]}