From patchwork Fri Dec 4 06:16:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66442C433FE for ; Fri, 4 Dec 2020 06:17:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F55522583 for ; Fri, 4 Dec 2020 06:17:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728047AbgLDGRP (ORCPT ); Fri, 4 Dec 2020 01:17:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbgLDGRO (ORCPT ); Fri, 4 Dec 2020 01:17:14 -0500 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1B24C061A51 for ; Thu, 3 Dec 2020 22:16:27 -0800 (PST) Received: by mail-ot1-x344.google.com with SMTP id 11so4206368oty.9 for ; Thu, 03 Dec 2020 22:16:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J6aTBf0SDpHve48rTJ5EpUCFxp9EXKC/Z1a9387wUXY=; b=eTqn5LLIGef+pKr92kag6Yv6+YmC1Ow35lTfqla1AhzKQZaKQeb2iVe7xU1dIP3PuB YOIuMy+WBY+4i9neNE8dAH4LhSCcNP7U4R9AT7z3iHcrl61PYe+vuC0EsHojcsL4f1mq v6+Q9kEBaa0obuuYmR8fhpCqhFVbYtg8oXhTGktIhJsgwq15ELqCNT18qsoXMZmkwheI BgzJ4KekHjXue1AffvjEEUTXXfz9WB3RDYSabYtfNJi1uqJIQQ7/rY5F2xyDH7H950Bm pA8MIXPh4tX97wRK1OB+c2TtMUPTekefRDAcQP3ILhaQRe5Saj+Lv22YNU/ccTTC0KsL xRiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J6aTBf0SDpHve48rTJ5EpUCFxp9EXKC/Z1a9387wUXY=; b=Bi6RsBt9w2qXgWvGv8ecgCuD0cHC2eh2GN3nwGq59d9uc7wDBDHdKJNcJKVCDP0fd/ P+RY53/SyOJohO1Uul8UFu4fMCt9xwJ7dX+1bNpm2pC3dttO1pTxEeo1OZHqoYLo8qgC FD4RWWfKi8AUHXYgL2+88t+K+t92YNR48/LRauFna3vR2Z/UxDGEH17+oKW9dWMKopXC F4Hxwq5OLHy89c3urONfp5r0YWlNysZNJZVjL1quwr9l2zI8kwd5EjhZyHDyCo2/m1D4 suiA69dchzLDcrCQ4Idl9+FptzN+YCdvnrZ/qC4WqbaTVIW2OUGWXYBvIzDI3AATOAjN a8zA== X-Gm-Message-State: AOAM532mdW9tLtW9wk5XYwjRFBhUP30mQjlksy9Yf9zRLS00BM2RnL0z 7WZ58FrH3g9a1os5yk8RQ+m7JtYHMeiaeg== X-Google-Smtp-Source: ABdhPJwkndzOnr9tAhw3KKwahF0QtDkNJ/VXT6K6WiS+xZyWJatX0BsFCakEzc7rvt9rSAXcabmf5Q== X-Received: by 2002:a9d:6a46:: with SMTP id h6mr2355625otn.270.1607062587140; Thu, 03 Dec 2020 22:16:27 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id k20sm448598oig.35.2020.12.03.22.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:26 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 01/14] doc: pull: explain what is a fast-forward Date: Fri, 4 Dec 2020 00:16:10 -0600 Message-Id: <20201204061623.1170745-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We want users to know what is a fast-forward in order to understand the default warning. Signed-off-by: Felipe Contreras --- Documentation/git-pull.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index 5c3fb67c01..dc812139f4 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -38,6 +38,20 @@ as set by linkgit:git-branch[1] `--track`. Assume the following history exists and the current branch is "`master`": +------------ + A---B---C master on origin + / + D---E master +------------ + +Then `git pull` will merge in a fast-foward way up to the new master. + +------------ + D---E---A---B---C master, origin/master +------------ + +However, a non-fast-foward case looks very different. + ------------ A---B---C master on origin / From patchwork Fri Dec 4 06:16:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F45FC4361A for ; Fri, 4 Dec 2020 06:17:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDA4022583 for ; Fri, 4 Dec 2020 06:17:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728058AbgLDGRQ (ORCPT ); Fri, 4 Dec 2020 01:17:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbgLDGRP (ORCPT ); Fri, 4 Dec 2020 01:17:15 -0500 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CAE9C061A52 for ; Thu, 3 Dec 2020 22:16:29 -0800 (PST) Received: by mail-oi1-x244.google.com with SMTP id t205so4996359oib.12 for ; Thu, 03 Dec 2020 22:16:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F6j4zcz+F8jnl8C6sJDoj9Jj9aLIQONW+a1m1oL90yU=; b=lr6rNBQwKZrnTVT1c8Hufwk7kJZ8VkwN2qEq8VbJ4NQ7evK7igtSqFIFzMPH5Mpqok ExgnYHEHnp4TDAWkmbdYIzGRuELeIhjgbzmPOMECiM60338emfc4rD3ziI5MVBvW7Jad S1/RiuxcHATxohaWbqie87PNNCJYrR4hzVqPcrSi73KfHNfNQ7h9nOA7GQo8FI3WirOT OpWROXY9Dtd/Ckv9f6duSjwvTLk/0QtVTypnC8fjWXVznIVBeqhYcyUZdiV67NFM0yh9 2uWUVfHu5Y+3R3npEeU9uvFW99JZFQ212RBusK59gaZt6zwFvQsa/gZWuNahXgPV9KdA p/pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F6j4zcz+F8jnl8C6sJDoj9Jj9aLIQONW+a1m1oL90yU=; b=h7BzGUZXX3mydbNHmx60rnYnOWyj/NA5AlOiPS+Xs7m6wH7M6t/UoM6kk4kvOAq9iC 3X19IXeESgC/N0y4hDcSRv87zRaLf/O014FgsoL7yxL+kGPCibjyw/e6TqrQWnk2LTQd dHPr65cZBc4OTe/hMicU+dV/748xgPdO0WuPxE8w3wDB+Zo22FukwOuwHsyz33nLH7SW 5g7MGqbOU1+i+XeRJEfUbm2uFIBlBL916axDrLS+CMWO22u8h8vCK3UOIxPlIP9WvLoA xopVWSChz82XXGZW/TgRPQd5VkclKBncCHvu6bs6Dm6K2GF0FnP/cOs8giFSuQSW3brG 3yYQ== X-Gm-Message-State: AOAM530VZlhPTwedg1Wmlv9vGuB09o1SqZIybKclKHNK8w/ZEWpq2eL4 DkvLXVQb5hpV3tvrT3CEqUxD18q6bF5Oaw== X-Google-Smtp-Source: ABdhPJwi6tcj73TgPyhIFUfVd0tRhQR7V1/VrMq4fP/0eVgcvG9OYnbPSdWASqM2rMXJFgJ54mqhHA== X-Received: by 2002:aca:5402:: with SMTP id i2mr2161260oib.38.1607062588713; Thu, 03 Dec 2020 22:16:28 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id a21sm449751otr.36.2020.12.03.22.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:28 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 02/14] pull: improve default warning Date: Fri, 4 Dec 2020 00:16:11 -0600 Message-Id: <20201204061623.1170745-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We want to: 1. Be clear about what "specifying" means; merge or rebase. 2. Mention a direct shortcut for people that just want to get on with their lives: git pull --no-rebase. 3. Have a quick reference for users to understand what this "fast-forward" business means. This patch does all three. Thanks to the previous patch now "git pull --help" explains what a fast-forward is, and a further patch changes --no-rebase to --merge so it's actually user friendly. Signed-off-by: Felipe Contreras --- builtin/pull.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/builtin/pull.c b/builtin/pull.c index 1034372f8b..22a9ffcade 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -346,17 +346,18 @@ static enum rebase_type config_get_rebase(void) if (opt_verbosity >= 0 && !opt_ff) { advise(_("Pulling without specifying how to reconcile divergent branches is\n" - "discouraged. You can squelch this message by running one of the following\n" - "commands sometime before your next pull:\n" - "\n" - " git config pull.rebase false # merge (the default strategy)\n" - " git config pull.rebase true # rebase\n" - " git config pull.ff only # fast-forward only\n" - "\n" - "You can replace \"git config\" with \"git config --global\" to set a default\n" - "preference for all repositories. You can also pass --rebase, --no-rebase,\n" - "or --ff-only on the command line to override the configured default per\n" - "invocation.\n")); + "discouraged; you need to specify if you want a merge, or a rebase.\n" + "You can squelch this message by running one of the following commands:\n" + "\n" + " git config pull.rebase false # merge (the default strategy)\n" + " git config pull.rebase true # rebase\n" + " git config pull.ff only # fast-forward only\n" + "\n" + "You can replace \"git config\" with \"git config --global\" to set a default\n" + "preference for all repositories.\n" + "If unsure, run \"git pull --no-rebase\".\n" + "Read \"git pull --help\" for more information." + )); } return REBASE_FALSE; From patchwork Fri Dec 4 06:16:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF40BC4361A for ; Fri, 4 Dec 2020 06:17:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8992622583 for ; Fri, 4 Dec 2020 06:17:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727920AbgLDGRL (ORCPT ); Fri, 4 Dec 2020 01:17:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbgLDGRL (ORCPT ); Fri, 4 Dec 2020 01:17:11 -0500 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 457F5C061A53 for ; Thu, 3 Dec 2020 22:16:31 -0800 (PST) Received: by mail-ot1-x344.google.com with SMTP id f12so4186056oto.10 for ; Thu, 03 Dec 2020 22:16:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nlxduxWQ2zYB6MQdSxkaIOFRjry5hQNNrUCA0ESi3Vw=; b=g8ukK7YDOfRnGXDCeL94H1pmAVHmRfRi/0EC2RlpNzeYqVGLlOS8DrJ3SlYdCOx/TR sg2U4uomGCauKJiz2Vm9OwbRvxFC1L4vUIsg0Q+9FXzHyfbNCoAl5EMcoKHb2vSOlcIg X3SHMxZof4QJGeyRkfGQ3sczkr2bcCmB0PvyPQ9JYcR6lJXX+AsBSlcXPDrKMI7vfQZG lxwa+hqK7oyLZC5v2cePfTmjyDjutBnxiN+3qUz73gqK21tCuR94neYvell/S5tgFO8j JIXZZB70p0lh+rewvuDRSAJUm4X5a/rMCtXAuoepBLVZVOhmK8xh/lG/YODzf+L6+zFM QgQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nlxduxWQ2zYB6MQdSxkaIOFRjry5hQNNrUCA0ESi3Vw=; b=Mxnl+vHBzbenmDRVXIP1rWzxEBKKou3fWEtG2CAU/AC4aPV3P82qduGqafvXBZ8Zt6 e1O6DHhRkWfTrhzokfhFD/hS2Fc5Mzf/RhUjf/qngXiEGtdlEPorM4DAT+plLLr4EqLE r8HaGypYzssfzHQfrrlWF5fTrp9GeBByODjBRXpa89ivGfDryQl4mOIfT55PkWQQbumY tiFtzRDQHa1LsB8fxvBdcWM1XhKRrDOi+rIWlBYMQmOtyXYSVpKc26QY6orehoSW/36q Q739LXcBrJz7qfGV8bEqhrjNTJ3UuOloaqOgXmKNdWtRER25TRYI61E7+fmn+aw7iMLj QkBw== X-Gm-Message-State: AOAM532S+4PcRlB0wAoLaUF7xzLTtwMBigtJMG8StHRjtS0MUJLXCQEs H/nWb/LxXykUFjbZgrHcMpzIjlVwm8q/yQ== X-Google-Smtp-Source: ABdhPJxbcN9L9YYIWY3vFK/Pa0kAd1dcCQRP0NpdRzKAFICoLLKZS2KwFacgc7toSyUEbRyFVB2jog== X-Received: by 2002:a9d:3a24:: with SMTP id j33mr2419919otc.259.1607062590505; Thu, 03 Dec 2020 22:16:30 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id p3sm442050otf.3.2020.12.03.22.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:29 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 03/14] pull: refactor fast-forward check Date: Fri, 4 Dec 2020 00:16:12 -0600 Message-Id: <20201204061623.1170745-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This way we will be able to do the check unconditionally (merge or rebase). Signed-off-by: Felipe Contreras --- builtin/pull.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/builtin/pull.c b/builtin/pull.c index 22a9ffcade..6279e9ee37 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -907,6 +907,20 @@ static int run_rebase(const struct object_id *curr_head, return ret; } +static int get_can_ff(struct object_id *orig_head, struct object_id *orig_merge_head) +{ + int ret; + struct commit_list *list = NULL; + struct commit *merge_head, *head; + + head = lookup_commit_reference(the_repository, orig_head); + commit_list_insert(head, &list); + merge_head = lookup_commit_reference(the_repository, orig_merge_head); + ret = repo_is_descendant_of(the_repository, merge_head, list); + free_commit_list(list); + return ret; +} + int cmd_pull(int argc, const char **argv, const char *prefix) { const char *repo, **refspecs; @@ -1017,22 +1031,12 @@ int cmd_pull(int argc, const char **argv, const char *prefix) submodule_touches_in_range(the_repository, &rebase_fork_point, &curr_head)) die(_("cannot rebase with locally recorded submodule modifications")); if (!autostash) { - struct commit_list *list = NULL; - struct commit *merge_head, *head; - - head = lookup_commit_reference(the_repository, - &orig_head); - commit_list_insert(head, &list); - merge_head = lookup_commit_reference(the_repository, - &merge_heads.oid[0]); - if (repo_is_descendant_of(the_repository, - merge_head, list)) { + if (get_can_ff(&orig_head, &merge_heads.oid[0])) { /* we can fast-forward this without invoking rebase */ opt_ff = "--ff-only"; ran_ff = 1; ret = run_merge(); } - free_commit_list(list); } if (!ran_ff) ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point); From patchwork Fri Dec 4 06:16:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58362C4361B for ; Fri, 4 Dec 2020 06:17:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B6D622583 for ; Fri, 4 Dec 2020 06:17:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728032AbgLDGRN (ORCPT ); Fri, 4 Dec 2020 01:17:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbgLDGRN (ORCPT ); Fri, 4 Dec 2020 01:17:13 -0500 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCA38C061A54 for ; Thu, 3 Dec 2020 22:16:32 -0800 (PST) Received: by mail-oi1-x241.google.com with SMTP id f11so5029528oij.6 for ; Thu, 03 Dec 2020 22:16:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bpb4AW0FnDSITGZhGs/OZ8d0SJ4KUvBeaZzOGwKSBtE=; b=uPtU30LFyOq7PQ7iAkjRCEgWdZ3hRBGxFIYhN/fKNCC3NFveojBvNw81y5Iebct2PF UmVJ5+m1JgiMDHS0bVQ3UAMiSOtir+hDtOtZeVKRSv4AiwsiQ5975XSIZS75kCwg7mCb 8RDGTZlRycCbUXonhxWD3BGvn2iOzkh+wtVqkTK84qiEXU5EZ/XdtZeWUNXVs29K0h+L zV6AL+o4fgIn3JOSHtg1NqrWmq1NLL5/nvEiuKACekqPUzmQFQttsMjzttqtZfhvqD6F h7WzB3TA0urilZ0Bxm/YBiAfQqZVjM10HS5PiZdA8XuYwg/8ZcyVyEdNDXanbEL+i7qL d63Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bpb4AW0FnDSITGZhGs/OZ8d0SJ4KUvBeaZzOGwKSBtE=; b=ihlpMFkETSHMn6C2glfa9Fvsq3Su0rPAROshTbaIH/ed2JW6LN8VP0kRsgWIO6Llxi /4m0zaT/pyG1GTgK+tCjU6J+BXcRd31gC+haNNULbBGPTVDcIEJWamdyt+1/xq0J5Fwh IYGyLx2kdN3IEI30z+Y2Pi3i79bFUYFodxzFasqc74j+QvevwBvQapvNAIdABCDQPbJl 4rYVhLwU2z5jP2i/KpRZU2wID2+9F4uEUS9tINttcY9r+obVA4FTR1e/DInmC39uQovW pzpIhBBCAkRP80bMDRK812kfutt5G1Vxlu9tmFzXhYY+P5LG3ZIeaDqFVIRqDkr/J5ao WJPQ== X-Gm-Message-State: AOAM532jBbvLjIjl+top46OSOsHksTNZKnEcXqHaMLsxgVjuiVoVK3SG xqs184vSyMmAPjKzAfyODMSSbjPykQKQWg== X-Google-Smtp-Source: ABdhPJwlTraRtx2IeMlrWmEp/8QJH3doPGAZi5pBE9kz//g53rM9I429AY//yuJq/hD71lPcSzeXlw== X-Received: by 2002:aca:b108:: with SMTP id a8mr2183907oif.108.1607062592034; Thu, 03 Dec 2020 22:16:32 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id k1sm426351ood.4.2020.12.03.22.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:31 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 04/14] pull: cleanup autostash check Date: Fri, 4 Dec 2020 00:16:13 -0600 Message-Id: <20201204061623.1170745-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This essentially reverts commit f15e7cf5cc. Once commit d9f15d37f1 introduced the autostash option for the merge mode, it's not necessary to skip the fast-forward run_merge() when autostash is set. Signed-off-by: Felipe Contreras --- builtin/pull.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/builtin/pull.c b/builtin/pull.c index 6279e9ee37..c38548dab8 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -927,7 +927,6 @@ int cmd_pull(int argc, const char **argv, const char *prefix) struct oid_array merge_heads = OID_ARRAY_INIT; struct object_id orig_head, curr_head; struct object_id rebase_fork_point; - int autostash; if (!getenv("GIT_REFLOG_ACTION")) set_reflog_message(argc, argv); @@ -960,8 +959,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix) if (get_oid("HEAD", &orig_head)) oidclr(&orig_head); - autostash = config_autostash; if (opt_rebase) { + int autostash = config_autostash; if (opt_autostash != -1) autostash = opt_autostash; @@ -1030,13 +1029,11 @@ int cmd_pull(int argc, const char **argv, const char *prefix) recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) && submodule_touches_in_range(the_repository, &rebase_fork_point, &curr_head)) die(_("cannot rebase with locally recorded submodule modifications")); - if (!autostash) { - if (get_can_ff(&orig_head, &merge_heads.oid[0])) { - /* we can fast-forward this without invoking rebase */ - opt_ff = "--ff-only"; - ran_ff = 1; - ret = run_merge(); - } + if (get_can_ff(&orig_head, &merge_heads.oid[0])) { + /* we can fast-forward this without invoking rebase */ + opt_ff = "--ff-only"; + ran_ff = 1; + ret = run_merge(); } if (!ran_ff) ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point); From patchwork Fri Dec 4 06:16:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53DCBC4361B for ; Fri, 4 Dec 2020 06:17:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CCCE22597 for ; Fri, 4 Dec 2020 06:17:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726270AbgLDGRr (ORCPT ); Fri, 4 Dec 2020 01:17:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgLDGRr (ORCPT ); Fri, 4 Dec 2020 01:17:47 -0500 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9879C061A55 for ; Thu, 3 Dec 2020 22:16:34 -0800 (PST) Received: by mail-ot1-x344.google.com with SMTP id y24so4227900otk.3 for ; Thu, 03 Dec 2020 22:16:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EBCaGz/kPZXyIa+ai5/KJhc94Mzn+CBnk+qFYabAI6s=; b=ldXIi8Em2KxTzkCry6yaLCsMUKhPlwbw7HDDW35UpCCD5rmEOZgKgEanrhkljgaHPl rbAhzAcmOtcbKCQxMkJJQaI7Qfro8dW/DLjC2Y1B1Zpgh9MgHiGJ7e1c7xiqa/ZwWlZe +LgLDTPwoAj4sp0j66Ca65a5D0eqQrBBdwzLZd7/pFWRNBFaBSREKPAbzBzDXbRlAaWb Zrp6iqSpVrlrtR3KOXO7v8B9MxvGL2JoNRmd/q0lL87IALVuwEnuVYXuNFIuNicWA9hh 1Dv9k3VLvxOcjFSu3q2qtru4go9i/SA/hND1JOlR2R0CMKCnnQt6VkhtHRUFYH9HqO6r Ht4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EBCaGz/kPZXyIa+ai5/KJhc94Mzn+CBnk+qFYabAI6s=; b=YHK2aq2mH2McTXZemHBJ0QfKTZwtbaJ44ZFGbG99LRxevox1/AbmY8dsWHcyU2VOOj 0YLXWmJkkZbaXOnPQJCGlmjd4JJwEN4JpNjxX1HzH6mz13Ce/LRneIv8zfW/LkdPGg1Y 2ScNYIPiHRQ/l+q6KGzMmkUMtW/yjRMEUCGudEjzxMziz3Ccg7J0NVX2yxDKLSmN0syN SyRzVdpItdzWt/NnNpJ5h5pptwo1ifYWPVlugA+a5kKI9X0gigYkKd6Wn9h9M7iWqhpq uZEdB9+oqW0kBWRInRyc3AdhOv+uFRHus+55mGE/5tTQvpNcU7CpbUPXOhSalVq0b90A RnPQ== X-Gm-Message-State: AOAM531b4lTRC2UF3TTbzDk8b1vKDoYBItf2OIKpWFXYALOJwO3SeZNI tS8MA0OvvQheX4yHdhyDXtghRk7U8JYPuA== X-Google-Smtp-Source: ABdhPJxKHts5HydQh+moyt7Bot3ekoRIiJ8lT5cvtIZIlYb7A1VpZ5FJ0Lv+y8Jp+ptB4ZqKQV+yEg== X-Received: by 2002:a05:6830:1d3:: with SMTP id r19mr2365492ota.333.1607062594039; Thu, 03 Dec 2020 22:16:34 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id k5sm458615oot.30.2020.12.03.22.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:33 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 05/14] pull: trivial cleanup Date: Fri, 4 Dec 2020 00:16:14 -0600 Message-Id: <20201204061623.1170745-6-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There's no need to store ran_ff. Now it's obvious from the conditionals. Signed-off-by: Felipe Contreras --- builtin/pull.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/builtin/pull.c b/builtin/pull.c index c38548dab8..8daba7539c 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -1024,19 +1024,18 @@ int cmd_pull(int argc, const char **argv, const char *prefix) if (opt_rebase) { int ret = 0; - int ran_ff = 0; if ((recurse_submodules == RECURSE_SUBMODULES_ON || recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) && submodule_touches_in_range(the_repository, &rebase_fork_point, &curr_head)) die(_("cannot rebase with locally recorded submodule modifications")); + if (get_can_ff(&orig_head, &merge_heads.oid[0])) { /* we can fast-forward this without invoking rebase */ opt_ff = "--ff-only"; - ran_ff = 1; ret = run_merge(); - } - if (!ran_ff) + } else { ret = run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point); + } if (!ret && (recurse_submodules == RECURSE_SUBMODULES_ON || recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND)) From patchwork Fri Dec 4 06:16:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5315C4361A for ; Fri, 4 Dec 2020 06:17:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62037225AC for ; Fri, 4 Dec 2020 06:17:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbgLDGRr (ORCPT ); Fri, 4 Dec 2020 01:17:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgLDGRr (ORCPT ); Fri, 4 Dec 2020 01:17:47 -0500 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72196C061A56 for ; Thu, 3 Dec 2020 22:16:37 -0800 (PST) Received: by mail-ot1-x343.google.com with SMTP id f12so4186254oto.10 for ; Thu, 03 Dec 2020 22:16:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gc+SnzFY8q3WTBBmCreJK/5eg9jHtbWwXpaiLtv50BE=; b=cL7OeLtTv5m8ImiwU4nZjwUvshtwJlCm+1cWSiHs9ItN06AQuFGUVdJ6rH6bGBkGTZ 1Y73mc9/MnYuq7+VB5cq5Bht9cqNLl8rBukZfkRWQ/qRHrbnsmtRq/GXkpndL/A0TgIl dcC2k+1pKsD6spkm9LhNB9XZ9zgz9QPJ+Nh1Sr4T5Ec8MEM85GV0pYmvyOqWr1DGewg7 Hr+wWEo/M8UqqHpVPccGyDojwXzpLL9qik26c/KuMRp3zNtbkNzHa1PBdS9iMIe9GHgJ 1d2sS6bkVegQkRZkWeRqK9E7Cc/xxFdxDBg80X81/Sn+QSnCIEYtj8hu6k5ilvz4ZCcx w6Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gc+SnzFY8q3WTBBmCreJK/5eg9jHtbWwXpaiLtv50BE=; b=aaXIsK4HzqsnRuCy1OhqBL5brM8XFaauOzX6FhZ6iHTWuNvy94E17ZX2n+jHnCqGVK Ul5Od856SAByU7Ae8i0itQkcOSXkZN4iwZgKPd4KkZazDV96p/+TCoTi7Yr0uR7YM3Oq eSGA4zkk1NPlpXos1dVK0z6EHVzbnB1cfhOnPjcrKs2iEmdQ93li94+uTUu3hyfAKsUD mAX/LPMdmO1/rV+6LOO0Nm1C19qj+HEiZKzwWyNDdBWELfxJjh6BZbQjaxKW4SZMTMrE +E+O5u0fiLLuv8vtJ7zceqcMbL8GVBh0gkEtFB8OQRrSPzPrpAim+6TUG6s9nNOcEja/ jrzg== X-Gm-Message-State: AOAM532/FAiNWbpQp+K1mq2SuGgmA2Bp10pmlSfATbQtN0tUPWKA4Hox 47B2u/KbyUHYH3d6uEXJ64PE+UG4H5qPxg== X-Google-Smtp-Source: ABdhPJyEL0JM6prBAzX2oXviz2l4QYGpl3hTS6GcKpX5E8GQLhRg6hRgt+bIeMIpCg77p8QIeBjzGA== X-Received: by 2002:a9d:7411:: with SMTP id n17mr2419296otk.262.1607062596614; Thu, 03 Dec 2020 22:16:36 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id s28sm441490otd.2.2020.12.03.22.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:36 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 06/14] pull: move default warning Date: Fri, 4 Dec 2020 00:16:15 -0600 Message-Id: <20201204061623.1170745-7-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Up to the point where can check if we can fast-forward or not. No functional changes. Signed-off-by: Felipe Contreras --- builtin/pull.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/builtin/pull.c b/builtin/pull.c index 8daba7539c..f82e214fc8 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -27,6 +27,8 @@ #include "commit-reach.h" #include "sequencer.h" +static int default_mode; + /** * Parses the value of --rebase. If value is a false value, returns * REBASE_FALSE. If value is a true value, returns REBASE_TRUE. If value is @@ -344,21 +346,7 @@ static enum rebase_type config_get_rebase(void) if (!git_config_get_value("pull.rebase", &value)) return parse_config_rebase("pull.rebase", value, 1); - if (opt_verbosity >= 0 && !opt_ff) { - advise(_("Pulling without specifying how to reconcile divergent branches is\n" - "discouraged; you need to specify if you want a merge, or a rebase.\n" - "You can squelch this message by running one of the following commands:\n" - "\n" - " git config pull.rebase false # merge (the default strategy)\n" - " git config pull.rebase true # rebase\n" - " git config pull.ff only # fast-forward only\n" - "\n" - "You can replace \"git config\" with \"git config --global\" to set a default\n" - "preference for all repositories.\n" - "If unsure, run \"git pull --no-rebase\".\n" - "Read \"git pull --help\" for more information." - )); - } + default_mode = 1; return REBASE_FALSE; } @@ -927,6 +915,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix) struct oid_array merge_heads = OID_ARRAY_INIT; struct object_id orig_head, curr_head; struct object_id rebase_fork_point; + int can_ff; if (!getenv("GIT_REFLOG_ACTION")) set_reflog_message(argc, argv); @@ -1022,6 +1011,24 @@ int cmd_pull(int argc, const char **argv, const char *prefix) if (opt_rebase && merge_heads.nr > 1) die(_("Cannot rebase onto multiple branches.")); + can_ff = get_can_ff(&orig_head, &merge_heads.oid[0]); + + if (default_mode && opt_verbosity >= 0 && !opt_ff) { + advise(_("Pulling without specifying how to reconcile divergent branches is\n" + "discouraged; you need to specify if you want a merge, or a rebase.\n" + "You can squelch this message by running one of the following commands:\n" + "\n" + " git config pull.rebase false # merge (the default strategy)\n" + " git config pull.rebase true # rebase\n" + " git config pull.ff only # fast-forward only\n" + "\n" + "You can replace \"git config\" with \"git config --global\" to set a default\n" + "preference for all repositories.\n" + "If unsure, run \"git pull --no-rebase\".\n" + "Read \"git pull --help\" for more information." + )); + } + if (opt_rebase) { int ret = 0; if ((recurse_submodules == RECURSE_SUBMODULES_ON || @@ -1029,7 +1036,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix) submodule_touches_in_range(the_repository, &rebase_fork_point, &curr_head)) die(_("cannot rebase with locally recorded submodule modifications")); - if (get_can_ff(&orig_head, &merge_heads.oid[0])) { + if (can_ff) { /* we can fast-forward this without invoking rebase */ opt_ff = "--ff-only"; ret = run_merge(); From patchwork Fri Dec 4 06:16:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CDBBC4167B for ; Fri, 4 Dec 2020 06:17:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F0B322583 for ; Fri, 4 Dec 2020 06:17:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728108AbgLDGR6 (ORCPT ); Fri, 4 Dec 2020 01:17:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgLDGR5 (ORCPT ); Fri, 4 Dec 2020 01:17:57 -0500 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0208DC08C5F2 for ; Thu, 3 Dec 2020 22:16:39 -0800 (PST) Received: by mail-oi1-x241.google.com with SMTP id l207so2128428oib.4 for ; Thu, 03 Dec 2020 22:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g403MEr1OfI9sycspKwBy3ZzBdW6PPDv/NTjdHribuA=; b=HEuOwpyEnL9Y6ExNko2EZYGeOJQ2zG+mpxYKjffvu0hEc3Rwbq1oUN8hJjSPVBFb1p hnmGc6zxKCeA3hkrKEavBeNlTNhmGmcKOhIAq8+4CSmULRZtGmSxi/l6TQ59Um1/LmqN LXchIQ7CARvhtjZX3fKkjZZGaxpC54wkgSnR5GLKp2oyJNTXpbuzfi/kB7wjhdlEEbe1 EJYNiWryVfLh6Mm/8ShwRYWlgkeVCSpZvmP+w4SYCgP2VIj3m/3Uz4S7q1gCD2MYJhR7 5FnYK6KMijRbpWm+92oPAldwnKz0ryMogDvkLcYR2C5dx36MXFyqixoyMZfv65nfWl93 QAHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g403MEr1OfI9sycspKwBy3ZzBdW6PPDv/NTjdHribuA=; b=dfSxVX0BAvnO5icFWJ+w6YGu1NFXPmCk9vj+l+4nZdODvsd0TC7ZPIJTZEN8VUtTsj 9zEpid17VCY21TF+T23Rgo0W048GfOsf+mN4koTImnDA51KdPQtk6IqBGRCqcp4vUlwS 7KuJsBirZiX17yRPjQoUoYm4Q56VNKM9z0hpvaptjvrflnUGy4gL8g3cd+Ey8ODIAW/5 IyBrnn+JIUruLGN+yAYNUFiPgxhEymjKGousnN647dLFvcxFmXtUumhm8qWRR+cbZV/8 FS1fKa/LVUN7nAUa26Gr9rzqwFxzrLcfTyjro6KOLI75Tz5fEKjHdta3oKsee3vEtXfj WoBg== X-Gm-Message-State: AOAM531zzD+VH54cZ7wJKhMyJxyw5pHDB9OTEBM11f13PNP9LnIIJmiD bKPB2Ot7bg2rz4g+np4KlkVr0JSfqBylSA== X-Google-Smtp-Source: ABdhPJx8E8wTinSP8hcrM/fCNzeeQUXjVdXUbDME1e5nGH+sDdB+jpmGzG0d+OygGp+OFp5q3/cCQg== X-Received: by 2002:aca:b587:: with SMTP id e129mr2133939oif.90.1607062598157; Thu, 03 Dec 2020 22:16:38 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id m109sm435450otc.30.2020.12.03.22.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:37 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 07/14] pull: display default warning only when non-ff Date: Fri, 4 Dec 2020 00:16:16 -0600 Message-Id: <20201204061623.1170745-8-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There's no need to display the annoying warning on every pull... only the ones that are not fast-forward. This requires the tests to pick another base, so the merge is not fast-forward. Signed-off-by: Felipe Contreras --- Documentation/git-pull.txt | 3 +++ builtin/pull.c | 2 +- t/t7601-merge-pull-config.sh | 28 +++++++++++++++++----------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index dc812139f4..ad33d2472c 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -60,6 +60,9 @@ However, a non-fast-foward case looks very different. origin/master in your repository ------------ +By default `git pull` will warn about these situations, however, most likely +you would want to force a merge, which you can do with `git pull --no-rebase`. + Then "`git pull`" will fetch and replay the changes from the remote `master` branch since it diverged from the local `master` (i.e., `E`) until its current commit (`C`) on top of `master` and record the diff --git a/builtin/pull.c b/builtin/pull.c index f82e214fc8..f0b1c6bfea 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -1013,7 +1013,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix) can_ff = get_can_ff(&orig_head, &merge_heads.oid[0]); - if (default_mode && opt_verbosity >= 0 && !opt_ff) { + if (default_mode && !can_ff && opt_verbosity >= 0 && !opt_ff) { advise(_("Pulling without specifying how to reconcile divergent branches is\n" "discouraged; you need to specify if you want a merge, or a rebase.\n" "You can squelch this message by running one of the following commands:\n" diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh index 6774e9d86f..6b4adab8b1 100755 --- a/t/t7601-merge-pull-config.sh +++ b/t/t7601-merge-pull-config.sh @@ -28,7 +28,7 @@ test_expect_success 'setup' ' ' test_expect_success 'pull.rebase not set' ' - git reset --hard c0 && + git reset --hard c2 && git -c color.advice=always pull . c1 2>err && test_decode_color decoded && test_i18ngrep "hint: " decoded && @@ -36,54 +36,60 @@ test_expect_success 'pull.rebase not set' ' ' -test_expect_success 'pull.rebase not set and pull.ff=true' ' +test_expect_success 'pull.rebase not set (fast-forward)' ' git reset --hard c0 && + git pull . c1 2>err && + test_i18ngrep ! "Pulling without specifying how to reconcile" err +' + +test_expect_success 'pull.rebase not set and pull.ff=true' ' + git reset --hard c2 && test_config pull.ff true && git pull . c1 2>err && test_i18ngrep ! "Pulling without specifying how to reconcile" err ' test_expect_success 'pull.rebase not set and pull.ff=false' ' - git reset --hard c0 && + git reset --hard c2 && test_config pull.ff false && git pull . c1 2>err && test_i18ngrep ! "Pulling without specifying how to reconcile" err ' test_expect_success 'pull.rebase not set and pull.ff=only' ' - git reset --hard c0 && + git reset --hard c2 && test_config pull.ff only && - git pull . c1 2>err && + test_must_fail git pull . c1 2>err && test_i18ngrep ! "Pulling without specifying how to reconcile" err ' test_expect_success 'pull.rebase not set and --rebase given' ' - git reset --hard c0 && + git reset --hard c2 && git pull --rebase . c1 2>err && test_i18ngrep ! "Pulling without specifying how to reconcile" err ' test_expect_success 'pull.rebase not set and --no-rebase given' ' - git reset --hard c0 && + git reset --hard c2 && git pull --no-rebase . c1 2>err && test_i18ngrep ! "Pulling without specifying how to reconcile" err ' test_expect_success 'pull.rebase not set and --ff given' ' - git reset --hard c0 && + git reset --hard c2 && git pull --ff . c1 2>err && test_i18ngrep ! "Pulling without specifying how to reconcile" err ' test_expect_success 'pull.rebase not set and --no-ff given' ' - git reset --hard c0 && + git reset --hard c2 && git pull --no-ff . c1 2>err && test_i18ngrep ! "Pulling without specifying how to reconcile" err ' test_expect_success 'pull.rebase not set and --ff-only given' ' - git reset --hard c0 && - git pull --ff-only . c1 2>err && + git reset --hard c2 && + test_must_fail git pull --ff-only . c1 2>err && test_i18ngrep ! "Pulling without specifying how to reconcile" err ' From patchwork Fri Dec 4 06:16:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D0E7C433FE for ; Fri, 4 Dec 2020 06:17:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E058922583 for ; Fri, 4 Dec 2020 06:17:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727972AbgLDGRw (ORCPT ); Fri, 4 Dec 2020 01:17:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgLDGRv (ORCPT ); Fri, 4 Dec 2020 01:17:51 -0500 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E58EC08E85E for ; Thu, 3 Dec 2020 22:16:40 -0800 (PST) Received: by mail-ot1-x343.google.com with SMTP id w3so3570465otp.13 for ; Thu, 03 Dec 2020 22:16:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oezrrA3ark1Rsun3Yi2/SRG7RZyrFaHuyx7ajAhhqkg=; b=i0/eUKUDzWTnSVPyv3yA7424RHpwZzfYjsALB7fxiwn6CACeD0D0wP06NQoCuHBdDp 7ednfPZZwLJSitgBUmFcvdEomsnb7cxl+emrx4V7COBYjnXm2TURl0P7R5/oC8bbSlCh XxBd2hVNUEDfgYKaRYGTEPvI81+S079ep42nEHG8KV/Hy/+KwPK3MahXiaNC/nOQxvt+ d+5TrymZcvmwkjDsQZYGdO7EjwLDsnTURZgidhZUOmBaQcCY3kELwgSdtUR8zCN1V0aV +ztGTVSbO20nbwR4rrXsv0jdAdkamLELIbQ5Pqlt6eU+duurqHQ+4eWvM65RnC5Oqaqq VnYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oezrrA3ark1Rsun3Yi2/SRG7RZyrFaHuyx7ajAhhqkg=; b=oXEDB1aYg4I7zdxYLtiEf4zXhKVWe9Z5nyAedFcxlqovrLIddsvAp13e9xpweVxaqk lQdk1mK3oWHwCvEoLoc6to6+/ktKGal2fLcyvOF2ZRDTDUGSqz6lhsUNb44XVXQ+aEgQ d97FE9IEPVCRn6Ee8DqQypIeFwGVlRpRZpFrO4JdyOD7PYh6EscZy++y/RXmL/tIr33v B4+VMny6sp7OQLFD50jOtMxRZRWvEYTt9Q/oeJ4xJkoSa+uNQPPQxHDMuX67XwQSS9by E86LUIogxPHIMeiND9RDr/w0w+LG1p72aFLa2bhJf1JkPpYaTSMb6RGfN0o7P6m3j3ww zhyQ== X-Gm-Message-State: AOAM533fCQWOlQNYVBN7YB6hSrPZCz8dxnPQ18JVscQ/b6RKpDQ/HKb/ kK8VGBiIFJWM44baE4fdbT2pdq/8UqGJkw== X-Google-Smtp-Source: ABdhPJy0b+hNAya5sHT+Zi69Tuq9gyLxijeeA4N0KEUF9ik0+3/TnweyFUmdO4FFS+r/aohTQJKEGw== X-Received: by 2002:a05:6830:104f:: with SMTP id b15mr2491916otp.20.1607062599669; Thu, 03 Dec 2020 22:16:39 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id r12sm461493ooo.25.2020.12.03.22.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:39 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 08/14] pull: trivial whitespace style fix Date: Fri, 4 Dec 2020 00:16:17 -0600 Message-Id: <20201204061623.1170745-9-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Two spaces unaligned to anything is not part of the coding-style. A single tab is. Signed-off-by: Felipe Contreras --- builtin/pull.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/pull.c b/builtin/pull.c index f0b1c6bfea..b200f7544c 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -128,9 +128,9 @@ static struct option pull_options[] = { /* Options passed to git-merge or git-rebase */ OPT_GROUP(N_("Options related to merging")), OPT_CALLBACK_F('r', "rebase", &opt_rebase, - "(false|true|merges|preserve|interactive)", - N_("incorporate changes by rebasing rather than merging"), - PARSE_OPT_OPTARG, parse_opt_rebase), + "(false|true|merges|preserve|interactive)", + N_("incorporate changes by rebasing rather than merging"), + PARSE_OPT_OPTARG, parse_opt_rebase), OPT_PASSTHRU('n', NULL, &opt_diffstat, NULL, N_("do not show a diffstat at the end of the merge"), PARSE_OPT_NOARG | PARSE_OPT_NONEG), From patchwork Fri Dec 4 06:16:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDA48C4361B for ; Fri, 4 Dec 2020 06:18:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 893B322597 for ; Fri, 4 Dec 2020 06:18:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728114AbgLDGR7 (ORCPT ); Fri, 4 Dec 2020 01:17:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgLDGR7 (ORCPT ); Fri, 4 Dec 2020 01:17:59 -0500 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3489EC08E85F for ; Thu, 3 Dec 2020 22:16:42 -0800 (PST) Received: by mail-oi1-x244.google.com with SMTP id t143so5013845oif.10 for ; Thu, 03 Dec 2020 22:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TEzwLjbmSnTJQosFhHvBja9SD2pcRvmyFnA6PY+Y8t4=; b=Mz7oi1aENBDLk5Ph/Qx0siGH8Wc3BEgxM3t/eFu1FKniZoYYe9zhzRMD9e6Mfh6hGj 4XxybBu+DtBmo1sZZEdtPatAij2kbt80Mge8d5kFv1lM53rre7QiNnpapSjwlOI3rjWv ZTU01SrDlsaystxLmvE2GIrfvo5wMD7WCv8hZNNwju7/DWeNuKo0r6xCZ7lmWYqjlPnv rUpu/3RDd1ZwZ4+GgLReSM3ON1JESWKVzNaklZGbemD1c6/WlrRn0kR51TqaoOGP7yek xCG9Uy8ZERe5Y8YDu8u+pRNbhpwoG1muQMqysl+WrPYLuKuLJvXWydu3TLBnMXaBRDF2 iqMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TEzwLjbmSnTJQosFhHvBja9SD2pcRvmyFnA6PY+Y8t4=; b=mDXAU0xGO80MRu/6+baNMGRhE2V5i7nbUscGSa7SsIIh3mtFzf7O/bAKc72N6fmpoB 2hbwT/O1FtRsv8RUw1/0tnuF/RNDcQbd5bzFent7tPBvbNJiV2RfbKIc3YGtfdrVh7Ss iHHOidJWC9rrs5xqO+98zrZNQzYsL9QWDuJKeyMJvVWJD3LI44kjBwKqsqL3q/aTjggt LkjI6wXc1jvcJbw2ogavKu5jWhinxy+ZqYoj5G8EL8E4b0/Y45NpNkwi9XgKnDIRXdRT LB81DCwpNzg+S9wB8NrNgFMtkr0ECDm/h6wiy7ltl+TzY6u1SVFZC5Xh6uNqH8AQY/wM GXGA== X-Gm-Message-State: AOAM533xpQEhPvpSZSb7s+WOdLaYV041k4iZ/rO65N/UaKM7OdsCLa13 41e5esYljwCEVnVB6e85Efud7x/qfsUsaQ== X-Google-Smtp-Source: ABdhPJzDuDoJgOCfkuZfTMbtDrTV0uyBS3tSLfUsxGz513ZEJt+mikhBUgL7ndaKGkqqfXYKEm6/3Q== X-Received: by 2002:aca:5453:: with SMTP id i80mr2114521oib.2.1607062601402; Thu, 03 Dec 2020 22:16:41 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id l12sm471241ooe.27.2020.12.03.22.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:40 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 09/14] pull: introduce --merge option Date: Fri, 4 Dec 2020 00:16:18 -0600 Message-Id: <20201204061623.1170745-10-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Previously --no-rebase (which still works for backwards compatbility). Now we can update the default warning, and the git-pull(1) man page to use --merge instead of the non-intuitive --no-rebase. Signed-off-by: Felipe Contreras --- Documentation/git-pull.txt | 9 ++++++--- builtin/pull.c | 4 +++- t/t7601-merge-pull-config.sh | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index ad33d2472c..c220da143a 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -61,7 +61,7 @@ However, a non-fast-foward case looks very different. ------------ By default `git pull` will warn about these situations, however, most likely -you would want to force a merge, which you can do with `git pull --no-rebase`. +you would want to force a merge, which you can do with `git pull --merge`. Then "`git pull`" will fetch and replay the changes from the remote `master` branch since it diverged from the local `master` (i.e., `E`) @@ -148,8 +148,11 @@ It rewrites history, which does not bode well when you published that history already. Do *not* use this option unless you have read linkgit:git-rebase[1] carefully. ---no-rebase:: - Override earlier --rebase. +-m:: +--merge:: + Force a merge. ++ +Previously this was --no-rebase, but that usage has been deprecated. Options related to fetching ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/builtin/pull.c b/builtin/pull.c index b200f7544c..6ea95c9fc9 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -131,6 +131,8 @@ static struct option pull_options[] = { "(false|true|merges|preserve|interactive)", N_("incorporate changes by rebasing rather than merging"), PARSE_OPT_OPTARG, parse_opt_rebase), + OPT_SET_INT('m', "merge", &opt_rebase, + N_("incorporate changes by merging"), 0), OPT_PASSTHRU('n', NULL, &opt_diffstat, NULL, N_("do not show a diffstat at the end of the merge"), PARSE_OPT_NOARG | PARSE_OPT_NONEG), @@ -1024,7 +1026,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix) "\n" "You can replace \"git config\" with \"git config --global\" to set a default\n" "preference for all repositories.\n" - "If unsure, run \"git pull --no-rebase\".\n" + "If unsure, run \"git pull --merge\".\n" "Read \"git pull --help\" for more information." )); } diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh index 6b4adab8b1..1de64e6cc5 100755 --- a/t/t7601-merge-pull-config.sh +++ b/t/t7601-merge-pull-config.sh @@ -69,9 +69,9 @@ test_expect_success 'pull.rebase not set and --rebase given' ' test_i18ngrep ! "Pulling without specifying how to reconcile" err ' -test_expect_success 'pull.rebase not set and --no-rebase given' ' +test_expect_success 'pull.rebase not set and --merge given' ' git reset --hard c2 && - git pull --no-rebase . c1 2>err && + git pull --merge . c1 2>err && test_i18ngrep ! "Pulling without specifying how to reconcile" err ' From patchwork Fri Dec 4 06:16:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBCA4C433FE for ; Fri, 4 Dec 2020 06:17:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6B1C22583 for ; Fri, 4 Dec 2020 06:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728020AbgLDGRx (ORCPT ); Fri, 4 Dec 2020 01:17:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgLDGRx (ORCPT ); Fri, 4 Dec 2020 01:17:53 -0500 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5277C08E860 for ; Thu, 3 Dec 2020 22:16:44 -0800 (PST) Received: by mail-oi1-x229.google.com with SMTP id l200so5012704oig.9 for ; Thu, 03 Dec 2020 22:16:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UBT0EzIpt85yh3IsT1vov9e0v0rvq4h5XCzypgwxYFU=; b=aBJBlnU6ma0FizDe5mc7C6P+r5kp68yn3LVGa189H1RH3YP7NcivyzwHpB7CypTaS6 5+P+gap/aPt8qR/8lHNoMIGSUdP0tbNk46b+xQaXh1pGVuEN6Aw7J2rHYwt3cL5TAfvT de2sZJ2WaKuPhFfKIEwgzLX2UpBc/o4MvyqyCjTaeXyjSpc1/6p+fFlg87zCYyvnlzmX H9qJoEXxfqzBmio4E9swy+bwYcA6vflcALGk3eDyHLp2GX2NNpcY2pa3y2So5H7McbFq woF1oEBGMQXBEUOQhscrVN2B2PirSLr+GDvlmJeMfUVApas+KWeyrrkjCzZv3PaG1vCO YHjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UBT0EzIpt85yh3IsT1vov9e0v0rvq4h5XCzypgwxYFU=; b=FUWGE/M41hBWcFx8SnBmeCB9XaBUhROOZdeHZzRpsqe6mgOfti7oW/ZmvcBdfGEWcw VcMwSJ2xErOQD/m0WpWtIR5mG9ovd5h25xihbtZd5tUn1eq2p867STtTGQ8zalcgiAHz bO9I/J1xfeKvkoyODmzYP6wtUmlZTT3i3Dc6m07W4ViocEoeCPz5A3sbZIoITAVeHMma y9pQLwewNwmMfLbWf+5kBzERnbT1vLFysZrVgkicuLRctZtlb93ZEC71CSjLUvVQwvB7 ubi4pzUBxyVTehJrKEVsPS3qxc5KyqxEoVuBX7C95Ch17KWqjejvBvd/w0dYNALn0TpE VpNQ== X-Gm-Message-State: AOAM5323jTbxJT/pQ3tODTEgfRqsHnJ/7Ou1KhXLxhToc+dtPH+tS5en m1fwXAvlbFSrulA3HqoN9HEBb3j4hsasfA== X-Google-Smtp-Source: ABdhPJzS+OrdOTjYo9o8xDwx/mQRlNPltzDEpPFGoYdhzCvqxg+SXqKRyJFpVqCKbJQEHWHc5MB2BA== X-Received: by 2002:aca:cf0a:: with SMTP id f10mr2035053oig.11.1607062603977; Thu, 03 Dec 2020 22:16:43 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id k1sm426414ood.4.2020.12.03.22.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:43 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 10/14] pull: add proper error with --ff-only Date: Fri, 4 Dec 2020 00:16:19 -0600 Message-Id: <20201204061623.1170745-11-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The current error is not user-friendly: fatal: not possible to fast-forward, aborting. We want something that actually explains what is going on: The pull was not fast-forward, please either merge or rebase. If unsure, run "git pull --merge". The user can get rid of the warning by doing either --merge or --rebase. Except: doing "git pull --merge" is not actually enough; we would return to the previous behavior: "fatal: not possible to fast-forward, aborting." Signed-off-by: Felipe Contreras --- builtin/pull.c | 34 ++++++++++++++++----------- t/t5520-pull.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 14 deletions(-) diff --git a/builtin/pull.c b/builtin/pull.c index 6ea95c9fc9..f54ff36b57 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -1015,20 +1015,26 @@ int cmd_pull(int argc, const char **argv, const char *prefix) can_ff = get_can_ff(&orig_head, &merge_heads.oid[0]); - if (default_mode && !can_ff && opt_verbosity >= 0 && !opt_ff) { - advise(_("Pulling without specifying how to reconcile divergent branches is\n" - "discouraged; you need to specify if you want a merge, or a rebase.\n" - "You can squelch this message by running one of the following commands:\n" - "\n" - " git config pull.rebase false # merge (the default strategy)\n" - " git config pull.rebase true # rebase\n" - " git config pull.ff only # fast-forward only\n" - "\n" - "You can replace \"git config\" with \"git config --global\" to set a default\n" - "preference for all repositories.\n" - "If unsure, run \"git pull --merge\".\n" - "Read \"git pull --help\" for more information." - )); + if (!can_ff && default_mode) { + if (opt_ff && !strcmp(opt_ff, "--ff-only")) { + die(_("The pull was not fast-forward, please either merge or rebase.\n" + "If unsure, run \"git pull --merge\".")); + } + if (opt_verbosity >= 0 && !opt_ff) { + advise(_("Pulling without specifying how to reconcile divergent branches is\n" + "discouraged; you need to specify if you want a merge, or a rebase.\n" + "You can squelch this message by running one of the following commands:\n" + "\n" + " git config pull.rebase false # merge (the default strategy)\n" + " git config pull.rebase true # rebase\n" + " git config pull.ff only # fast-forward only\n" + "\n" + "You can replace \"git config\" with \"git config --global\" to set a default\n" + "preference for all repositories.\n" + "If unsure, run \"git pull --merge\".\n" + "Read \"git pull --help\" for more information." + )); + } } if (opt_rebase) { diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 9fae07cdfa..fdd1f79b06 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -819,4 +819,66 @@ test_expect_success 'git pull --rebase against local branch' ' test_cmp expect file2 ' +test_expect_success 'git pull fast-forward (ff-only)' ' + test_when_finished "git checkout master && git branch -D other test" && + test_config pull.ff only && + git checkout -b other master && + >new && + git add new && + git commit -m new && + git checkout -b test -t other && + git reset --hard master && + git pull +' + +test_expect_success 'git pull non-fast-forward (ff-only)' ' + test_when_finished "git checkout master && git branch -D other test" && + test_config pull.ff only && + git checkout -b other master^ && + >new && + git add new && + git commit -m new && + git checkout -b test -t other && + git reset --hard master && + test_must_fail git pull +' + +test_expect_failure 'git pull non-fast-forward with merge (ff-only)' ' + test_when_finished "git checkout master && git branch -D other test" && + test_config pull.ff only && + git checkout -b other master^ && + >new && + git add new && + git commit -m new && + git checkout -b test -t other && + git reset --hard master && + git pull --no-rebase +' + +test_expect_success 'git pull non-fast-forward with rebase (ff-only)' ' + test_when_finished "git checkout master && git branch -D other test" && + test_config pull.ff only && + git checkout -b other master^ && + >new && + git add new && + git commit -m new && + git checkout -b test -t other && + git reset --hard master && + git pull --rebase +' + +test_expect_success 'git pull non-fast-forward error message' ' + test_when_finished "git checkout master && git branch -D other test" && + test_config pull.ff only && + git checkout -b other master^ && + >new && + git add new && + git commit -m new && + git checkout -b test -t other && + git reset --hard master && + test_must_fail git pull 2> error && + cat error && + grep -q "The pull was not fast-forward" error +' + test_done From patchwork Fri Dec 4 06:16:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F06B4C4361A for ; Fri, 4 Dec 2020 06:17:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE90922583 for ; Fri, 4 Dec 2020 06:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728069AbgLDGRz (ORCPT ); Fri, 4 Dec 2020 01:17:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgLDGRz (ORCPT ); Fri, 4 Dec 2020 01:17:55 -0500 Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 694D4C08E861 for ; Thu, 3 Dec 2020 22:16:46 -0800 (PST) Received: by mail-oo1-xc34.google.com with SMTP id t142so1127067oot.7 for ; Thu, 03 Dec 2020 22:16:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4CqxZuY5ClZcezYpuu9BG5Qp6NclUxvC9oXw8k33WpM=; b=V3yFN8h88gm+D8UKiuoNVZuQ4W4912CwRyZy/HUg1saJkgJ7g/bsk+GEqwpDG35MFA ulitXOgsRt/kDLfci+DyR58tijPLf2ePz0DCyPKBxFi/sU25/BStDth0HZyqkJ5EYT5t BE1feVwUmSI+mXe1r4O8VfLQo+cZNcldFFtahqywm56hm6J3U5AaKags5OM2enyFs6Ug Oru4tgc9as+Q5a08LSMTEfcr4bNwCpBkZ3+DJJN+XBgolRxMMZaQfm946n75nAjJZ60x +GV5VbkaLlIkjZ3yEboFO/TE+WaKaE4/mEnoM0yTsncZ5S3Rdml+6qVTHJn7VD/gmApf SZ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4CqxZuY5ClZcezYpuu9BG5Qp6NclUxvC9oXw8k33WpM=; b=EeEYgIq5ppscDdTwocWngbSz8Cb28M0aY1S5ZhgcOTUJsE47g795E7YEIPnu7+x98E nDqau2Fr3un2BBPxEw2ZHfld5nGYgLY+h6fatbHCUEKSRqNOJlA4locsT3wKHD21Vqco m48fbRgGaA5ifouEcPSvXXxlvDngdsejH+0vADucZxXHPmXLinBnM6/bKhV9RD5q3AlK RbBHEWQTW8JBd1eoCZGqAQys7oezwn+ZIPDXO1MkqkeVVUCgC/hYIso3pipWsVQM7z1O 2S6KXW7eloCDt5Yl/cb2yN/vLK+5xoZ2a7HJUewrskkLwjPCEDRk7Am/z4eYcm+8L5h4 +T5w== X-Gm-Message-State: AOAM530CsJ7OkUHp2Mvda/l5h31jYFpX0GPRXg4wk7FnfWNgX2KzY49S 0W938T8fzBMBZ2cceB5eHpFSNZH7COKKKA== X-Google-Smtp-Source: ABdhPJwuPbZDk+7mltT+74TBc5+ZvqXA08kPOklisFR2COAvWBTM5Xok/OGQdcHXS7ljHswawxmT8g== X-Received: by 2002:a4a:dc1:: with SMTP id 184mr2337508oob.40.1607062605634; Thu, 03 Dec 2020 22:16:45 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id h3sm436421otq.33.2020.12.03.22.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:45 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 11/14] tentative: pull: change the semantics of --ff-only Date: Fri, 4 Dec 2020 00:16:20 -0600 Message-Id: <20201204061623.1170745-12-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We want --ff-only to make sense only when no --merge or --rebase option is specified. Currently --rebase already ignores --ff-only (or any other --ff option), but --merge fails. Make it so --ff-only is only considered in the default mode. Signed-off-by: Felipe Contreras --- builtin/pull.c | 4 ++++ t/t5520-pull.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/builtin/pull.c b/builtin/pull.c index f54ff36b57..ebf2ac687b 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -1037,6 +1037,10 @@ int cmd_pull(int argc, const char **argv, const char *prefix) } } + /* Disable --ff-only when --merge is specified */ + if (!can_ff && !default_mode && !opt_rebase && opt_ff && !strcmp(opt_ff, "--ff-only")) + opt_ff = NULL; + if (opt_rebase) { int ret = 0; if ((recurse_submodules == RECURSE_SUBMODULES_ON || diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index fdd1f79b06..eec6224fb0 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -843,7 +843,7 @@ test_expect_success 'git pull non-fast-forward (ff-only)' ' test_must_fail git pull ' -test_expect_failure 'git pull non-fast-forward with merge (ff-only)' ' +test_expect_success 'git pull non-fast-forward with merge (ff-only)' ' test_when_finished "git checkout master && git branch -D other test" && test_config pull.ff only && git checkout -b other master^ && From patchwork Fri Dec 4 06:16:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC1DEC4361A for ; Fri, 4 Dec 2020 06:17:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7EF5E22597 for ; Fri, 4 Dec 2020 06:17:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728082AbgLDGRz (ORCPT ); Fri, 4 Dec 2020 01:17:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728064AbgLDGRz (ORCPT ); Fri, 4 Dec 2020 01:17:55 -0500 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D895BC08E862 for ; Thu, 3 Dec 2020 22:16:48 -0800 (PST) Received: by mail-ot1-x32d.google.com with SMTP id f16so4191713otl.11 for ; Thu, 03 Dec 2020 22:16:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8EztL/JZzp/gZlPO5jFEmtoX5Nst/sXN7Rl9t6LdYGQ=; b=YFGKBJKq8H4K/J6z67Ns3InbQOdzRb7IC3XuyBvZ5iRue4supf7zRyfOk5xsmzX+8l JpqoayPSuYhRdmj/kI+eVdHWyYpnlp1lbb+ju9ZDvKCMlJ35OzfkVRV20qRpeovtCQBf KnOYtuxqFcaMwKTZLE4GrQQrQBQO8vo/KOKLlgxwjNm3IHVwvbyjnm/pcxkmEJxEe4w/ /k4/YKmSoqRJwkHHx5SjnUXuGcF5U/aq1nH7mhvAWJj5HbXVKMunKe5dU7boGMKO02wu LnQJCQKfvAqG/9BUp7izZlkYplMS9e9FHZIvdnaywY1l1y/V2LWiCgycyxbGJprlJnWb 67eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8EztL/JZzp/gZlPO5jFEmtoX5Nst/sXN7Rl9t6LdYGQ=; b=rL5ee/IR/KiKT3JFJOpX11iEjLKSIZIt7QI5mJGQimx5XZKtfQINIbA8xJnHpWvLU0 Bk5r0XfKzf8EZdxuveT/snHo0+pWLjiZZRntnVltA5wXFDoQo00OlXtbRpq+eaUPO+Ua KNkGX9Wbxs9xBMpzLgJz7ozqrS+aQEPkAQc7vu/H/MT4tUUkPORLwSnH/pCkTDN7+2Hn 4aRjkWTMwPOaOLlgQjYBc8awV6Dju9dTSSgKUJO/Gr9o5uAFy+Hd8g0Hn7hru+y7sUXK 4WVB0qk8Kh85dIIWXEy/OuOhpLCBBZHv4O0hAr+8mWd2sB4l+0iCMDTuQeJsGVmYhvYO Gpbw== X-Gm-Message-State: AOAM531zw/syZKwxWzxJk5S6pIUMjZPJGyY0BSBxUj0UVGe9V8hvxvv1 Z6gaiS+7YdmFF7RCZdxa+HzMWEeJAAPCxw== X-Google-Smtp-Source: ABdhPJz4GyxkaNlLGwc2lD/Az5LpEXAFeSN+S7tKoJgmVSqgxtUhL9GhhxzKamhh0SZ21C8W6gQLNQ== X-Received: by 2002:a05:6830:131a:: with SMTP id p26mr2433252otq.237.1607062608074; Thu, 03 Dec 2020 22:16:48 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id s189sm454662oia.7.2020.12.03.22.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:47 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 12/14] pull: show warning with --ff Date: Fri, 4 Dec 2020 00:16:21 -0600 Message-Id: <20201204061623.1170745-13-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org It's unclear why --ff should remove the warning, since: git pull --ff Is implicitly the same as: git pull Unless of course pull.ff is specified otherwise. Signed-off-by: Felipe Contreras --- builtin/pull.c | 2 +- t/t7601-merge-pull-config.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/pull.c b/builtin/pull.c index ebf2ac687b..e389ffcdc3 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -1020,7 +1020,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix) die(_("The pull was not fast-forward, please either merge or rebase.\n" "If unsure, run \"git pull --merge\".")); } - if (opt_verbosity >= 0 && !opt_ff) { + if (opt_verbosity >= 0 && (!opt_ff || !strcmp(opt_ff, "--ff"))) { advise(_("Pulling without specifying how to reconcile divergent branches is\n" "discouraged; you need to specify if you want a merge, or a rebase.\n" "You can squelch this message by running one of the following commands:\n" diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh index 1de64e6cc5..d709799f8b 100755 --- a/t/t7601-merge-pull-config.sh +++ b/t/t7601-merge-pull-config.sh @@ -46,7 +46,7 @@ test_expect_success 'pull.rebase not set and pull.ff=true' ' git reset --hard c2 && test_config pull.ff true && git pull . c1 2>err && - test_i18ngrep ! "Pulling without specifying how to reconcile" err + test_i18ngrep "Pulling without specifying how to reconcile" err ' test_expect_success 'pull.rebase not set and pull.ff=false' ' @@ -78,7 +78,7 @@ test_expect_success 'pull.rebase not set and --merge given' ' test_expect_success 'pull.rebase not set and --ff given' ' git reset --hard c2 && git pull --ff . c1 2>err && - test_i18ngrep ! "Pulling without specifying how to reconcile" err + test_i18ngrep "Pulling without specifying how to reconcile" err ' test_expect_success 'pull.rebase not set and --no-ff given' ' From patchwork Fri Dec 4 06:16:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F065C4361B for ; Fri, 4 Dec 2020 06:17:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9DBA22597 for ; Fri, 4 Dec 2020 06:17:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728098AbgLDGR5 (ORCPT ); Fri, 4 Dec 2020 01:17:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgLDGRz (ORCPT ); Fri, 4 Dec 2020 01:17:55 -0500 Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EAE7C08E863 for ; Thu, 3 Dec 2020 22:16:50 -0800 (PST) Received: by mail-ot1-x332.google.com with SMTP id b18so4240630ots.0 for ; Thu, 03 Dec 2020 22:16:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uWptlYuhXDCZAz0F+eIUPJTkgpL8Oxwz7vgAz6RQJ08=; b=Zm3WKz1y3h9+xNlimzGdGLW41KyfPcwdE9f1bfcDSerRA3n6qoNXPk3EBm6w2IqsAY MfEvFw/mVsoEw5OQEOtbst8C1F2D4I7BCIIhqHlOIbWBmodYW6HTkwe1m3lruxShvaEM kJteXFxz2ugFnJfYubYRZPHv4BjvYB8LPF2SYTKTBIHlV7ZLpAozApbaZfW/ZTTNQmmy vlolQSfsOLqqg3RXN6DKwocTmdBWTzSb7aF3ZJa5DYhQYJiH2fn3b5q0wppEz1UfHkul pQ02F6iSlQBN6aeL6O0aSTMOVlURmbobfiBFyRhamiEdYuviriGcmlrMdhTaeZCYZTji xN0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uWptlYuhXDCZAz0F+eIUPJTkgpL8Oxwz7vgAz6RQJ08=; b=AbWgBs3x19FWovGukPef4CvvDF2FBYw0fAXBrL7T8Wo/WuQzojLmI3HFfpOLQ43Vxb zjsbAlqqVGW5xkeUbQEFzMNuTtb7W+sG4rGFcLfKqyckxVNbbuAONOO1KOWX5yojfIs3 7raCSFyf7fur6zIPQLCiZcltVPFNUuu2OHVbDBs789RvuzHeAQfbR5CNsvy3WRRP4teu 8bd9OpCEHWT2WfnH/lJD4LNGbqITOtAVXOQn+JUtYIhAAG74JufarDBmDb6k6RCRg9A6 lqWYi8RQGuGvQ2iYZi8d8TmeepGukk9RyduH+iLaa5H3hb5WcoQbYgWEnLqVGCaJPsSs kPNg== X-Gm-Message-State: AOAM531KxJB3icZlY86F1PFjMBH1ZUTObWxukoiCw2By3U1ej0/+GCC+ I5xhbT68gC0977ltpgsWarbdDVBe+byHPQ== X-Google-Smtp-Source: ABdhPJy1tSzye5NPtXzCf9uB0kG0kK2F9453oMetg0c5Uw+hwufDEyKM/jo+mz1cMhPZ2pdxCwq2Lw== X-Received: by 2002:a9d:6250:: with SMTP id i16mr2505661otk.49.1607062609623; Thu, 03 Dec 2020 22:16:49 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id z77sm455769ooa.37.2020.12.03.22.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:49 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 13/14] test: merge-pull-config: trivial cleanup Date: Fri, 4 Dec 2020 00:16:22 -0600 Message-Id: <20201204061623.1170745-14-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Commit e01ae2a4a7 introduced an extra space. Signed-off-by: Felipe Contreras --- t/t7601-merge-pull-config.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh index d709799f8b..8a6aae564a 100755 --- a/t/t7601-merge-pull-config.sh +++ b/t/t7601-merge-pull-config.sh @@ -33,7 +33,6 @@ test_expect_success 'pull.rebase not set' ' test_decode_color decoded && test_i18ngrep "hint: " decoded && test_i18ngrep "Pulling without specifying how to reconcile" decoded - ' test_expect_success 'pull.rebase not set (fast-forward)' ' From patchwork Fri Dec 4 06:16:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 11950717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B23B9C433FE for ; Fri, 4 Dec 2020 06:17:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CD5222597 for ; Fri, 4 Dec 2020 06:17:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728095AbgLDGR4 (ORCPT ); Fri, 4 Dec 2020 01:17:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728076AbgLDGRz (ORCPT ); Fri, 4 Dec 2020 01:17:55 -0500 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEBA1C08E864 for ; Thu, 3 Dec 2020 22:16:51 -0800 (PST) Received: by mail-oi1-x244.google.com with SMTP id y74so5000585oia.11 for ; Thu, 03 Dec 2020 22:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3SnoBkZ3kSMVpgqZ5NeBlt0BY1cD/WY+UmHuiONhlg8=; b=JtSqslYsoffpflZm0ApWPcu51TvKPSUhChaDgbunjFt2yyDGo236bBXDMaiYrntfuP h+xPuE2wkMkqr3BDwUCsPzIm0x3H84s1qU9RMMziXbwiXqudULvx6eeXtW0UH76u9SWn U/RFknE86y17iqMxRTfb/B+VO+U0ZR8ChviHq1XcGuJYbTFMfhZ3/Nab1aM698mPzj2E FT4Oq1GI6McaxV444WtBAk5Jwo3AmINeNhyBdkpWLaLWZmyg5WsBws61EOiqceAQ8Twk 2AEeMefz4K9G4n3+qYixVUsyyaU+mZ684e2eckDP7qJBHwH5HEw2tgRYshsiyzSQQen3 h/Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3SnoBkZ3kSMVpgqZ5NeBlt0BY1cD/WY+UmHuiONhlg8=; b=i3a9LNhk8kMlPXCqAtC0ovqyKNBts4kww1df5AtHBrXna9VwpHsaEu/oLGwQJ8t4U5 qIYmC1rQcYbRngY3JcRaYD/eKKmyIAzKHaqiwzIJwgV2x1IoOWqXOcWkU/eOCGy/mQBE Vgbx8BkSaYueK+s8MNbyf6yIhCGUKGHD4jBb9KGNn37HazjThCqwfvYnk6uwUKielBcF Y6F32Gm1TEvLPx8MjLnBVEDq4wlJEqPFNDTrSx/OvF1/LhIY1/AhHUyHRwyHLR+KvqXB fNoRwboj1evRT/sn2HhTmmp+YdDFxpLFiAy5pLfyAo/zTEficKvFCrMUedUm4pi/gEF1 6lAA== X-Gm-Message-State: AOAM533iyoVh8IJmv0THR1smNRcTLC9TD6DvdVwVjFlaMztHzwNppenY imDHSFnBoCjZs4DR+cdVp7rUbgIw6eIKmg== X-Google-Smtp-Source: ABdhPJxma9e/N3Is5VBDYO0UIfIcJwZoHqTXHdkCmHRuHOiL7cShb3/W9DXACijVWDtTALDsQXdUsQ== X-Received: by 2002:aca:aa47:: with SMTP id t68mr2095695oie.15.1607062611145; Thu, 03 Dec 2020 22:16:51 -0800 (PST) Received: from localhost (189-209-26-110.static.axtel.net. [189.209.26.110]) by smtp.gmail.com with ESMTPSA id c1sm429364ots.68.2020.12.03.22.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 22:16:50 -0800 (PST) From: Felipe Contreras To: git@vger.kernel.org Cc: =?utf-8?q?V=C3=ADt_Ondruch?= , Alex Henrie , Junio C Hamano , Jeff King , Philip Oakley , "Theodore Y . Ts'o" , Jacob Keller , Elijah Newren , John Keeping , Richard Hansen , "Brian M. Carlson" , "W. Trevor King" , Felipe Contreras Subject: [PATCH v2 14/14] test: pull-options: revert unnecessary changes Date: Fri, 4 Dec 2020 00:16:23 -0600 Message-Id: <20201204061623.1170745-15-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204061623.1170745-1-felipe.contreras@gmail.com> References: <20201204061623.1170745-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Commit d18c950a69 changed these tests, but it's unclear why. Probably because earlier versions of the patch series died instead of printing a warning. Cc: Alex Henrie Signed-off-by: Felipe Contreras --- t/t5521-pull-options.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh index db1a381cd9..1a4fe2583a 100755 --- a/t/t5521-pull-options.sh +++ b/t/t5521-pull-options.sh @@ -11,10 +11,10 @@ test_expect_success 'setup' ' git commit -m one) ' -test_expect_success 'git pull -q --no-rebase' ' +test_expect_success 'git pull -q' ' mkdir clonedq && (cd clonedq && git init && - git pull -q --no-rebase "../parent" >out 2>err && + git pull -q "../parent" >out 2>err && test_must_be_empty err && test_must_be_empty out) ' @@ -30,10 +30,10 @@ test_expect_success 'git pull -q --rebase' ' test_must_be_empty out) ' -test_expect_success 'git pull --no-rebase' ' +test_expect_success 'git pull' ' mkdir cloned && (cd cloned && git init && - git pull --no-rebase "../parent" >out 2>err && + git pull "../parent" >out 2>err && test -s err && test_must_be_empty out) ' @@ -46,10 +46,10 @@ test_expect_success 'git pull --rebase' ' test_must_be_empty out) ' -test_expect_success 'git pull -v --no-rebase' ' +test_expect_success 'git pull -v' ' mkdir clonedv && (cd clonedv && git init && - git pull -v --no-rebase "../parent" >out 2>err && + git pull -v "../parent" >out 2>err && test -s err && test_must_be_empty out) ' @@ -62,25 +62,25 @@ test_expect_success 'git pull -v --rebase' ' test_must_be_empty out) ' -test_expect_success 'git pull -v -q --no-rebase' ' +test_expect_success 'git pull -v -q' ' mkdir clonedvq && (cd clonedvq && git init && - git pull -v -q --no-rebase "../parent" >out 2>err && + git pull -v -q "../parent" >out 2>err && test_must_be_empty out && test_must_be_empty err) ' -test_expect_success 'git pull -q -v --no-rebase' ' +test_expect_success 'git pull -q -v' ' mkdir clonedqv && (cd clonedqv && git init && - git pull -q -v --no-rebase "../parent" >out 2>err && + git pull -q -v "../parent" >out 2>err && test_must_be_empty out && test -s err) ' test_expect_success 'git pull --cleanup errors early on invalid argument' ' mkdir clonedcleanup && (cd clonedcleanup && git init && - test_must_fail git pull --no-rebase --cleanup invalid "../parent" >out 2>err && + test_must_fail git pull --cleanup invalid "../parent" >out 2>err && test_must_be_empty out && test -s err) '