From patchwork Wed Jan 25 04:03:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114990 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1453FC54E94 for ; Wed, 25 Jan 2023 04:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233235AbjAYEED (ORCPT ); Tue, 24 Jan 2023 23:04:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbjAYEEB (ORCPT ); Tue, 24 Jan 2023 23:04:01 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36FC74902C for ; Tue, 24 Jan 2023 20:03:59 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id c10-20020a05600c0a4a00b003db0636ff84so402592wmq.0 for ; Tue, 24 Jan 2023 20:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=TELS1RC3bPR/JOiEBxfSoYL+GhZIw/AaeR38ux0uFNg=; b=PoUkiuTp2LiKTJ/w+D5REIFsHyFOd/CtEQbeHl12QDZUoEDzIFAACvCp0knzuM0U3m lgkWk+zvtdlgYqDax9zOVknfi1drwm7YThOA5cwPXqAmOXmu2F0Xkl1wKl+IqQJFvAhh lp4L34VTnU7OWpsw2WVzIVsYt7nMtTHlfMCRj20HN9IMpKgGRzOHyugw05/OS2kmyVz4 c2T4r2jFelaJNN/lf/LrsN1Rv2AFrGGnnpvQpRHGlQvacmhFBpO0ViSOpGj+YSOD8vkN lnuYUKwvod661gSy+9pN/bT+aPuTw60OqmsWXKf39KH0cYYvTPzNLFG8Y/P9AIS4ffs5 byAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TELS1RC3bPR/JOiEBxfSoYL+GhZIw/AaeR38ux0uFNg=; b=E7P1EmhheSMNBAbaxBp2dZbXf5SXfY+/67ZviGlPgpibtlidIljKCbWNGI6obt8Udg kmi6OiC3hbKSv0lLy8RamPCJeg3POYtX7e7osfR5dtSxZxDf0UjXUUGNUo2dgfT5vT/I SLKc+WXUUmBTGZFueej4ZxyPsR5GgNVRDcxeOOfjo23ZNuelNEpv2r7bpN+En/btSVoV f4oEFKlL8uyIblU5M0LqAyipHuWtaR0y97fTz+Otjz8kMFUQ8tYQANiyE/2sqFD57gQN EH/ZDVIaPKvP5+RXPFfT+iynqhytJh5zZrgj5C+gmaIJtnnO1Etja20RpYsVyOsxE7ub 6U/A== X-Gm-Message-State: AFqh2kqNeXHDNKu9ojJwiCUiKQ+rD+uGOptMFE038bsAVafzqzoDgtYb 43oByI7pn06Kf52+wGpfWo+KJFaTyEc= X-Google-Smtp-Source: AMrXdXvIHyUH2GonzU27l8bxWdNeKvHwQGA2iBaPvjy6RmAOt9/5ZPYZ6NFMyarA0VFK+UKKTamtJw== X-Received: by 2002:a05:600c:5116:b0:3da:212d:9dc0 with SMTP id o22-20020a05600c511600b003da212d9dc0mr30412898wms.14.1674619437587; Tue, 24 Jan 2023 20:03:57 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j8-20020adff008000000b00297dcfdc90fsm3276877wro.24.2023.01.24.20.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:03:56 -0800 (PST) Message-Id: <8a676e6ec1a30a0220ca0d222211a4cdbf0646a2.1674619434.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:45 +0000 Subject: [PATCH v5 01/10] rebase: mark --update-refs as requiring the merge backend Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren --update-refs is built in terms of the sequencer, which requires the merge backend. It was already marked as incompatible with the apply backend in the git-rebase manual, but the code didn't check for this incompatibility and warn the user. Check and error now. While at it, fix a typo in t3422...and fix some misleading wording (most options which used to be am-specific have since been implemented in the merge backend as well). Signed-off-by: Elijah Newren --- Documentation/git-rebase.txt | 2 ++ builtin/rebase.c | 3 +++ t/t3422-rebase-incompatible-options.sh | 15 ++++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index d811c1cf443..6490bc96a15 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -630,6 +630,8 @@ start would be overridden by the presence of + If the configuration variable `rebase.updateRefs` is set, then this option can be used to override and disable this setting. ++ +See also INCOMPATIBLE OPTIONS below. INCOMPATIBLE OPTIONS -------------------- diff --git a/builtin/rebase.c b/builtin/rebase.c index a26cc0cfdb5..c111b89e137 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1492,6 +1492,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) } } + if (options.update_refs) + imply_merge(&options, "--update-refs"); + if (options.type == REBASE_UNSPECIFIED) { if (!strcmp(options.default_backend, "merge")) imply_merge(&options, "--merge"); diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh index 6dabb05a2ad..9da39cd91c2 100755 --- a/t/t3422-rebase-incompatible-options.sh +++ b/t/t3422-rebase-incompatible-options.sh @@ -25,11 +25,11 @@ test_expect_success 'setup' ' ' # -# Rebase has lots of useful options like --whitepsace=fix, which are -# actually all built in terms of flags to git-am. Since neither -# --merge nor --interactive (nor any options that imply those two) use -# git-am, using them together will result in flags like --whitespace=fix -# being ignored. Make sure rebase warns the user and aborts instead. +# Rebase has a couple options which are specific to the apply backend, +# and several options which are specific to the merge backend. Flags +# from the different sets cannot work together, and we do not want to +# just ignore one of the sets of flags. Make sure rebase warns the +# user and aborts instead. # test_rebase_am_only () { @@ -60,6 +60,11 @@ test_rebase_am_only () { test_must_fail git rebase $opt --exec 'true' A " + test_expect_success "$opt incompatible with --update-refs" " + git checkout B^0 && + test_must_fail git rebase $opt --update-refs A + " + } test_rebase_am_only --whitespace=fix From patchwork Wed Jan 25 04:03:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 127A6C54E94 for ; Wed, 25 Jan 2023 04:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233880AbjAYEEG (ORCPT ); Tue, 24 Jan 2023 23:04:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232166AbjAYEED (ORCPT ); Tue, 24 Jan 2023 23:04:03 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 837E349032 for ; Tue, 24 Jan 2023 20:04:00 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id r2so15765852wrv.7 for ; Tue, 24 Jan 2023 20:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=JT7FIyhlcVRjmE3c8hSVm89gOiZ7LPsQqMxPR3H0tzY=; b=qRTDjp2hgeZ7/U5jt102zN+IEj/XD1g4aIlg5GP3lHfC4Hl7Oi/cwvFliHcNewdhU+ 2X8r1dtr02yx9NbV846kTf8CVNV5wtA0Cyi852p9XTwZnWhN6gZ5IWWZwxQedWjYb6mu FsEsWXJZIvXY3bX4l6jO14zG9BPhDS0T8qqsEw6OzalcWj71M4WLAByKl/H4aronWmDZ FtADi1/RfPr7W3BFtJ6pxdZtCMCU9UE/bs+KfeNLaaM2pl+YV28s1OfHsXLK6KezOZFl k+5fLQ6KBWO2x27prPPwsXQIAcNpty8A8YAEqTEGQUYvNbGpiu39+NRQ9YYlFk8900KV z/ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JT7FIyhlcVRjmE3c8hSVm89gOiZ7LPsQqMxPR3H0tzY=; b=xHSeKLTOolHXcFcb16u9SR4ezViH3Xf+8p1iCVjxjEIj3v4B6TJenlhttkXLeYdnyc 7MeZ/3osXZbWIUsUMpZqObRsTdl/OvDCTy5jqiB68TNA7ef3aTqJEXwjX6DE+nBCzNwt sy1s826omoQSnDdbjD0smerAPjRmRp4+SMwnQuFttGnn2ahlkJSZMtHF/sa19NCmZa3k IK08lJXr/J0wGDTBHBf2rE7knpiXKXb8Ww8d4i/ClLBCDe14Q/et5IexLqs0gZcH7dVP 7zohsh2pwyzZsyFhEz1onKa1O4ynNixVmEyVKooXCI7i3nh4NMuSbaVr0VAvRs/oaa4n rtnA== X-Gm-Message-State: AFqh2krECOTW7mNHdXXxgglfTqaHZXs+S/p4Ka/kyjobrTCp/V6wd/cn yuvoUPHAMrdKqjch/wryGs2ndYiD/YE= X-Google-Smtp-Source: AMrXdXs7dL3cof2kC4IMekwxxC9EGW9bny88+R8FOirMgl+sR79nGgnThv0Y+D3Sc7Rm1AtVEe/upA== X-Received: by 2002:a05:6000:81b:b0:2be:5c3d:99e3 with SMTP id bt27-20020a056000081b00b002be5c3d99e3mr18885148wrb.10.1674619438910; Tue, 24 Jan 2023 20:03:58 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z4-20020adfd0c4000000b002bdfe3aca17sm3206713wrh.51.2023.01.24.20.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:03:58 -0800 (PST) Message-Id: In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:46 +0000 Subject: [PATCH v5 02/10] rebase: flag --apply and --merge as incompatible Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Previously, we flagged options which implied --apply as being incompatible with options which implied --merge. But if both options were given explicitly, then we didn't flag the incompatibility. The same is true with --apply and --interactive. Add the check, and add some testcases to verify these are also caught. Signed-off-by: Elijah Newren --- builtin/rebase.c | 12 ++++++++++-- t/t3422-rebase-incompatible-options.sh | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index c111b89e137..b742cc8fb5c 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -907,6 +907,9 @@ static int parse_opt_am(const struct option *opt, const char *arg, int unset) BUG_ON_OPT_NEG(unset); BUG_ON_OPT_ARG(arg); + if (opts->type != REBASE_UNSPECIFIED && opts->type != REBASE_APPLY) + die(_("apply options and merge options cannot be used together")); + opts->type = REBASE_APPLY; return 0; @@ -920,8 +923,10 @@ static int parse_opt_merge(const struct option *opt, const char *arg, int unset) BUG_ON_OPT_NEG(unset); BUG_ON_OPT_ARG(arg); - if (!is_merge(opts)) - opts->type = REBASE_MERGE; + if (opts->type != REBASE_UNSPECIFIED && opts->type != REBASE_MERGE) + die(_("apply options and merge options cannot be used together")); + + opts->type = REBASE_MERGE; return 0; } @@ -935,6 +940,9 @@ static int parse_opt_interactive(const struct option *opt, const char *arg, BUG_ON_OPT_NEG(unset); BUG_ON_OPT_ARG(arg); + if (opts->type != REBASE_UNSPECIFIED && opts->type != REBASE_MERGE) + die(_("apply options and merge options cannot be used together")); + opts->type = REBASE_MERGE; opts->flags |= REBASE_INTERACTIVE_EXPLICIT; diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh index 9da39cd91c2..9b9e78479f6 100755 --- a/t/t3422-rebase-incompatible-options.sh +++ b/t/t3422-rebase-incompatible-options.sh @@ -67,7 +67,10 @@ test_rebase_am_only () { } +# Check options which imply --apply test_rebase_am_only --whitespace=fix test_rebase_am_only -C4 +# Also check an explicit --apply +test_rebase_am_only --apply test_done From patchwork Wed Jan 25 04:03:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114992 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DC38C61D9D for ; Wed, 25 Jan 2023 04:04:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234313AbjAYEEN (ORCPT ); Tue, 24 Jan 2023 23:04:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbjAYEED (ORCPT ); Tue, 24 Jan 2023 23:04:03 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A444858F for ; Tue, 24 Jan 2023 20:04:01 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id t18so2959803wro.1 for ; Tue, 24 Jan 2023 20:04:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=MwJKX1pubUfbYKbW0d6FbVwdVDuuAaPOALhhWeWyCOg=; b=SZBqRrPs1Mz5fkrLIdQeVk9QEmTJvCX1cOFVTy4dQLdIQ1VUf2F8mzTwnpWSL93ppS I9XbsufSb2PVu4sGmx/rz0at8HCRuiw91eWcWW0CgJ/2xIsdBxcd2dqCnzaM4z8kP8lI +ADDC/4gQuYHZ55m0/OVq6tgHHAUpTiO4naUhk1QaJ+RhUzjC895+hhh8fA1o27XykOk jPLxugVhupFbdP040VpQRKqPMzlIINu3htxr1dFuBT0IpFpw+D5tBLk7IhxcdUBVfDuc ioo9+by6qVjxyLbM9/8UZ/esKNWIOl/lIv55kzkQY7UuNisoLuG3Pvc7u3CdOurJNB9N cahQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MwJKX1pubUfbYKbW0d6FbVwdVDuuAaPOALhhWeWyCOg=; b=RuvouCYbWeMfhXuqO8xq8nl7rzUOMIFcfsB5ypPSh8s0Eru9CvXdXwVSGmQKVuW7+9 BwWkRMIbpzJfTuGExKZ5Frf1FWS2718ZpF9Gh960GxstyJH87m1JF2Qe9d9wsTTkLJXu 2a+EN7ndoUVaSAwz+DLezL3sfQcAJvgcK7dbV8mwePzu0sgLge1P8hKPvGGQn4IrI9nR NZBrcrz3Cl0ZDI4nvRIoTd+/VbolZKRuaPYf437Klmp4tlJe7KtNfxDSXiuY/+p5zV3Y xAUzQ4tfotlMEHFdD8gHqieDBXW/Yis9QWTLiy5eBfqTP8BhcJfCS9o0YzxNOKECecT0 oDEw== X-Gm-Message-State: AFqh2kq/N+RK4RIqHv64p379NIMIGipcFwc/xABaResF0CL+8DjpB0mD 02OufKGLhgJ9LuE/KvOAoO6d0GuZH60= X-Google-Smtp-Source: AMrXdXsT+p/su97gGyGTh0N86L33ZN4nuAcT+WXpyxUdOUUEYZUbpf/UZbscxatt6cuaDPFIxwQDtg== X-Received: by 2002:a5d:660b:0:b0:25d:4dfb:790c with SMTP id n11-20020a5d660b000000b0025d4dfb790cmr26036075wru.13.1674619439745; Tue, 24 Jan 2023 20:03:59 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q1-20020a5d5741000000b0029a06f11022sm3172712wrw.112.2023.01.24.20.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:03:59 -0800 (PST) Message-Id: <9464bbbe9ba60927a3c36ac9685545447744819c.1674619434.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:47 +0000 Subject: [PATCH v5 03/10] rebase: remove --allow-empty-message from incompatible opts Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren --allow-empty-message was turned into a no-op and even documented as such; the flag is simply ignored. Since the flag is ignored, it shouldn't be documented as being incompatible with other flags. Signed-off-by: Elijah Newren --- Documentation/git-rebase.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 6490bc96a15..7d01d1412d1 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -647,7 +647,6 @@ are incompatible with the following options: * --merge * --strategy * --strategy-option - * --allow-empty-message * --[no-]autosquash * --rebase-merges * --interactive From patchwork Wed Jan 25 04:03:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE2D2C27C76 for ; Wed, 25 Jan 2023 04:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234421AbjAYEEP (ORCPT ); Tue, 24 Jan 2023 23:04:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233639AbjAYEEE (ORCPT ); Tue, 24 Jan 2023 23:04:04 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BF9C4902C for ; Tue, 24 Jan 2023 20:04:02 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id k16so12846359wms.2 for ; Tue, 24 Jan 2023 20:04:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=xo1OaFfMKCy9YnGPXFMgi8mGCm66FoS1sHfeN+xzdBU=; b=DJomfAVXIxlRKBE0ZEBsxXAyeoK1IibOsFDpye5dbcBO5YTaisACbQIjI6nVgBF/T/ qOK4uwJXxYmd6izTaffzXqO6uj+8L+Ed6kPnROB3MJLle/npxEgKIYAyvZF9gPQsF5e7 UzkPXTKoKR4M8IQd8Ue0LMl8SHzCW+BjYxr1WvstnNoQ9TCF9Ycy5tPPdfCEbGVY5lHq YCv7kXkydwbBn43ymiNVPvaTCk+vzqYF7ag1b2wlocRnJrKQqSHDQA4kvgWgN7BKX5Kx WRDRL6jKfv+mrr5dWEL9KxS2UvlG+1uK/dhTgapwS2dL/hlB5/Hp9xme6Cxvo6wr02G1 GYfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xo1OaFfMKCy9YnGPXFMgi8mGCm66FoS1sHfeN+xzdBU=; b=CVZxtCt2ZHXPzgTiQkt+z+pU9xXyDuecW1luTEZjio50a+coQNj9GkD9WoXHSlGAXj 4VOKWLkzcwf7cd7JN7zBYcI5sVJqqtOEEtK1j1894BPzoTPT9dfP9YO+Ot5sBTO3SLJg 041RkXzhXoZoJaAKxFhnA8kCwpmx4IeW5k50Dw4vnLtrahsVv978Eq2QwJzL5wyGGX/l iaU4Hq/37hJScOUyq2WlxU4WkgXdxB4J0upJEl98iMsurM2K30x5Xo+yHBbl+Oay3q0G xmrdFCbIfbiBU7ohNcqmXkGyPRksbuf5bXG+Uouc+S3JBUiPUxdcov+erwpqsjgjqxjf oDXw== X-Gm-Message-State: AFqh2kqT/EoLUCFeugkhGjodrU20bP5EXq78kzNjk7qUI0Azzfvz+zSK V80a7qPVxC5RfJNfcxsOilZaXQ0Y+sg= X-Google-Smtp-Source: AMrXdXu2KHa38XbyAdIaKV0U4at1G/JnorUBL3qxrrlO0r59Qfjr9i5RbNpyy1gU1qPZWEaEsnBLbA== X-Received: by 2002:a05:600c:1e23:b0:3d9:103d:9081 with SMTP id ay35-20020a05600c1e2300b003d9103d9081mr27172141wmb.28.1674619440772; Tue, 24 Jan 2023 20:04:00 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x10-20020adfdcca000000b002bbddb89c71sm3194086wrm.67.2023.01.24.20.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:04:00 -0800 (PST) Message-Id: In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:48 +0000 Subject: [PATCH v5 04/10] rebase: fix docs about incompatibilities with --root Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren In commit 5dacd4abdd ("git-rebase.txt: document incompatible options", 2018-06-25), I added notes about incompatibilities between options for the apply and merge backends. Unfortunately, I inverted the condition when --root was incompatible with the apply backend. Fix the documentation, and add a testcase that verifies the documentation matches the code. While at it, the documentation for --root also tried to cover some of the backend differences between the apply and merge backends in relation to reapplying cherry picks. The information: * assumed that the apply backend was the default (it isn't anymore) * was written before --reapply-cherry-picks became an option * was written before the detailed information on backend differences All of these factors make the sentence under --root about reapplying cherry picks contradict information that is now available elsewhere in the manual, and the other references are correct. So just strike this sentence. Signed-off-by: Elijah Newren --- Documentation/git-rebase.txt | 7 ++----- t/t3422-rebase-incompatible-options.sh | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 7d01d1412d1..846aeed1b69 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -574,10 +574,7 @@ See also INCOMPATIBLE OPTIONS below. --root:: Rebase all commits reachable from ``, instead of limiting them with an ``. This allows you to rebase - the root commit(s) on a branch. When used with `--onto`, it - will skip changes already contained in `` (instead of - ``) whereas without `--onto` it will operate on every - change. + the root commit(s) on a branch. + See also INCOMPATIBLE OPTIONS below. @@ -656,7 +653,7 @@ are incompatible with the following options: * --reapply-cherry-picks * --edit-todo * --update-refs - * --root when used in combination with --onto + * --root when used without --onto In addition, the following pairs of options are incompatible: diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh index 9b9e78479f6..f86274990b0 100755 --- a/t/t3422-rebase-incompatible-options.sh +++ b/t/t3422-rebase-incompatible-options.sh @@ -65,6 +65,10 @@ test_rebase_am_only () { test_must_fail git rebase $opt --update-refs A " + test_expect_success "$opt incompatible with --root without --onto" " + git checkout B^0 && + test_must_fail git rebase $opt --root A + " } # Check options which imply --apply From patchwork Wed Jan 25 04:03:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC7DCC54E94 for ; Wed, 25 Jan 2023 04:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233949AbjAYEER (ORCPT ); Tue, 24 Jan 2023 23:04:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233732AbjAYEEF (ORCPT ); Tue, 24 Jan 2023 23:04:05 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B09249425 for ; Tue, 24 Jan 2023 20:04:03 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id j17so12873810wms.0 for ; Tue, 24 Jan 2023 20:04:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=/2fjKp1YFO64r9HSiFlkSpabozzOvEirsTx632yzoAA=; b=pSuCHfJSj4CtOGem+ako6P1CZ6DtjiL6qRyKl94zVBpaIeLSpgi4cXefdyIwAY/jrP pCCjmyCyyrr6wMRg0UvvbC8YQodmjH5hWOB2idrqk9AkcQe6FugemG0OoFZUbpNNbvLJ 0d34xd+qSMTWKCMYizGB6vHShzHQ6mxYQIYAjEA+hhaoZCv7PHu04gQnl0stLB5A+dGg BLLJ53ITjd10gbrj8m3v2DQtYS1Hp+mgwM2VgL/NQysVOTKd4wEUhbGzvQKKdow2vVjD muSNNplJ0A35e3QF0JVbcFJtWXttSoMVOOt+yrbZVNFp0lSAMIxL42zjMqSX2AtCIJXV Vluw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/2fjKp1YFO64r9HSiFlkSpabozzOvEirsTx632yzoAA=; b=yYCHChJr9LJkH2TbPyy6T61VtuV8LqOcYIvZW10Nu5lti3eWpg3c+6m13gQoj0/2kT 0Yj7NkGVSR99aizUHBumxrNQcMunZXRqjrpayvNH1V00fzTzMFJNVUmY8cVBennmznmT dMptqqmNeY4bj9NE0WPua6jQtgiRr4s8PANhHSg+JqvpcrzfxwbphA0VTGjQedkyYovJ sW/1qU/oFxjHEsdgRYQieHg/v2nWkRtF1NEoSdLOfx35piqoi/0pbv20MhnrVXICS7O6 MvmS7xzH6LxhEcYznpufWzzMy6S7sqFevyR0wRAPoWEWHb6YMU+HBH41M5W9i0n3AyRm iUxg== X-Gm-Message-State: AFqh2kpTYv4MuEUuTO8bSei3DyPLTRn6NZYF6ckpvROTWnLauOe6c4zh ZUMNoz+2Wze818Ejr43XxogZY3o2Rmg= X-Google-Smtp-Source: AMrXdXtKwUitLdfmKEk9vb7N0CMzmA6hB79HneSWjaQRx6dwCmhBpWqnmiuwwM6WDuzoUdI88ZJ0Hw== X-Received: by 2002:a05:600c:5025:b0:3db:14dc:8cff with SMTP id n37-20020a05600c502500b003db14dc8cffmr25509877wmr.33.1674619441856; Tue, 24 Jan 2023 20:04:01 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id o17-20020a05600c511100b003dc0d5b4fa6sm4919274wms.3.2023.01.24.20.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:04:01 -0800 (PST) Message-Id: <3a8429f3d2b72d59d0a071d83f6fd9effe6824ed.1674619434.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:49 +0000 Subject: [PATCH v5 05/10] rebase: fix incompatiblity checks for --[no-]reapply-cherry-picks Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren --[no-]reapply-cherry-picks was traditionally only supported by the sequencer. Support was added for the apply backend, when --keep-base is also specified, in commit ce5238a690 ("rebase --keep-base: imply --reapply-cherry-picks", 2022-10-17). Make the code error out when --[no-]reapply-cherry-picks is specified AND the apply backend is used AND --keep-base is not specified. Also, clarify a number of comments surrounding the interaction of these flags. Helped-by: Phillip Wood Signed-off-by: Elijah Newren --- Documentation/git-rebase.txt | 2 +- builtin/rebase.c | 34 ++++++++++++++++---------- t/t3422-rebase-incompatible-options.sh | 10 ++++++++ 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 846aeed1b69..8a09f12d897 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -650,7 +650,7 @@ are incompatible with the following options: * --exec * --no-keep-empty * --empty= - * --reapply-cherry-picks + * --[no-]reapply-cherry-picks when used without --keep-base * --edit-todo * --update-refs * --root when used without --onto diff --git a/builtin/rebase.c b/builtin/rebase.c index b742cc8fb5c..05b130bfae5 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1224,13 +1224,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if (options.fork_point < 0) options.fork_point = 0; } - /* - * --keep-base defaults to --reapply-cherry-picks to avoid losing - * commits when using this option. - */ - if (options.reapply_cherry_picks < 0) - options.reapply_cherry_picks = keep_base; - if (options.root && options.fork_point > 0) die(_("options '%s' and '%s' cannot be used together"), "--root", "--fork-point"); @@ -1406,12 +1399,27 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if (options.empty != EMPTY_UNSPECIFIED) imply_merge(&options, "--empty"); - /* - * --keep-base implements --reapply-cherry-picks by altering upstream so - * it works with both backends. - */ - if (options.reapply_cherry_picks && !keep_base) - imply_merge(&options, "--reapply-cherry-picks"); + if (options.reapply_cherry_picks < 0) + /* + * We default to --no-reapply-cherry-picks unless + * --keep-base is given; when --keep-base is given, we want + * to default to --reapply-cherry-picks. + */ + options.reapply_cherry_picks = keep_base; + else if (!keep_base) + /* + * The apply backend always searches for and drops cherry + * picks. This is often not wanted with --keep-base, so + * --keep-base allows --reapply-cherry-picks to be + * simulated by altering the upstream such that + * cherry-picks cannot be detected and thus all commits are + * reapplied. Thus, --[no-]reapply-cherry-picks is + * supported when --keep-base is specified, but not when + * --keep-base is left out. + */ + imply_merge(&options, options.reapply_cherry_picks ? + "--reapply-cherry-picks" : + "--no-reapply-cherry-picks"); if (gpg_sign) options.gpg_sign_opt = xstrfmt("-S%s", gpg_sign); diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh index f86274990b0..826f3b94ae6 100755 --- a/t/t3422-rebase-incompatible-options.sh +++ b/t/t3422-rebase-incompatible-options.sh @@ -60,6 +60,16 @@ test_rebase_am_only () { test_must_fail git rebase $opt --exec 'true' A " + test_expect_success "$opt incompatible with --no-reapply-cherry-picks" " + git checkout B^0 && + test_must_fail git rebase $opt --no-reapply-cherry-picks A + " + + test_expect_success "$opt incompatible with --reapply-cherry-picks" " + git checkout B^0 && + test_must_fail git rebase $opt --reapply-cherry-picks A + " + test_expect_success "$opt incompatible with --update-refs" " git checkout B^0 && test_must_fail git rebase $opt --update-refs A From patchwork Wed Jan 25 04:03:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9FD2C27C76 for ; Wed, 25 Jan 2023 04:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234493AbjAYEEV (ORCPT ); Tue, 24 Jan 2023 23:04:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233737AbjAYEEF (ORCPT ); Tue, 24 Jan 2023 23:04:05 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C2C49560 for ; Tue, 24 Jan 2023 20:04:04 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id f25-20020a1c6a19000000b003da221fbf48so384921wmc.1 for ; Tue, 24 Jan 2023 20:04:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=wyvq/IlO7sEBjMMcYmCwR5LXsNbar/KZ79T8kJVWycY=; b=eu7/bYu/gjkq76j36AtMsHcAK2RXPMeX0kt2dZsHyn43qkGfvEl3BIjCg36t0oVXP2 c8Z5VSbph5qCG8d243TOfxAGa6cvqREJLPjMxKDBaFHDhdWGiVkfwy6ARYnG003q/dAT p2t6Wwliuk+9pW6cHvWLawVKC4YoRkWlsX4BTkdyWFn9PytiCMOz6kAnsskqFVHZYFIj cHre30sEf45MrREYwCmKz4S2ZZ/05+1EFYLPxZN8yM8dfwgkXi+n0oIIvuqMaflNqFvu Xl9Exp9TVoxBspzFIMpjI6IvdCNMcqVAgDIFHrQeCey/dYVWw4ybTOxFuxULQqVUA/Us 13iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wyvq/IlO7sEBjMMcYmCwR5LXsNbar/KZ79T8kJVWycY=; b=liIPE4hWdgolVQboYDBuvcZoKKYFQViKZIpMIOozo2LiP5t3iRYoR0I27yDYTUj/+a 8IbcN3PAMJ1qUxpSUrhU3/3MMX04mx+w/H2BNBECM0NTYEynG1u2sUMqCQU6UBQWJUNw Tul7K8W+WdmH1ju4MXpUBqefAYBsBt5ISDtAT9CtDnfXQfTiYqsH3dVl5ysh76IcLFT4 RePaiFco6ozvbbvePUo+B7eiA/PnWRLn1M0OoBSr1zZzj3tw5JIbq4Bzr9l/OHFGa6kM UsGnI944RxzP7B7eAjCOvx5iUoX5Mg1N3VYGkFUPuXWUhKg8xjStdl1QJDTwZHYPPKbE PUgw== X-Gm-Message-State: AFqh2krtE1vm2clC2/3k0mrL+o7kJjWPOHRmXE78hgOoHMpAKRUABSRg frn63uDikfjJ9mUMs73oSv+Dio6245Q= X-Google-Smtp-Source: AMrXdXu/o+n+FX9FUqggCWGe43LCCWPjgtkqUDZzl1pJwn3n4ydJo66VMxMdI/m2odI72hIALoCLOA== X-Received: by 2002:a05:600c:281:b0:3da:1132:4b63 with SMTP id 1-20020a05600c028100b003da11324b63mr30313584wmk.5.1674619442613; Tue, 24 Jan 2023 20:04:02 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id o3-20020a05600c4fc300b003db1d9553e7sm535899wmq.32.2023.01.24.20.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:04:02 -0800 (PST) Message-Id: <2777dd2788a9bbb4687cb236642c37a2f538858f.1674619434.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:50 +0000 Subject: [PATCH v5 06/10] rebase: add coverage of other incompatible options Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren The git-rebase manual noted several sets of incompatible options, but we were missing tests for a few of these. Further, we were missing code checks for one of these, which could result in command line options being silently ignored. Also, note that adding a check for autosquash means that using --whitespace=fix together with the config setting rebase.autosquash=true will trigger an error. A subsequent commit will improve the error message. Signed-off-by: Elijah Newren --- builtin/rebase.c | 3 +++ t/t3422-rebase-incompatible-options.sh | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index 05b130bfae5..d6b20a6a536 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1511,6 +1511,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if (options.update_refs) imply_merge(&options, "--update-refs"); + if (options.autosquash) + imply_merge(&options, "--autosquash"); + if (options.type == REBASE_UNSPECIFIED) { if (!strcmp(options.default_backend, "merge")) imply_merge(&options, "--merge"); diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh index 826f3b94ae6..6a17b571ec7 100755 --- a/t/t3422-rebase-incompatible-options.sh +++ b/t/t3422-rebase-incompatible-options.sh @@ -50,6 +50,11 @@ test_rebase_am_only () { test_must_fail git rebase $opt --strategy-option=ours A " + test_expect_success "$opt incompatible with --autosquash" " + git checkout B^0 && + test_must_fail git rebase $opt --autosquash A + " + test_expect_success "$opt incompatible with --interactive" " git checkout B^0 && test_must_fail git rebase $opt --interactive A @@ -60,6 +65,16 @@ test_rebase_am_only () { test_must_fail git rebase $opt --exec 'true' A " + test_expect_success "$opt incompatible with --keep-empty" " + git checkout B^0 && + test_must_fail git rebase $opt --keep-empty A + " + + test_expect_success "$opt incompatible with --empty=..." " + git checkout B^0 && + test_must_fail git rebase $opt --empty=ask A + " + test_expect_success "$opt incompatible with --no-reapply-cherry-picks" " git checkout B^0 && test_must_fail git rebase $opt --no-reapply-cherry-picks A From patchwork Wed Jan 25 04:03:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 199AEC54E94 for ; Wed, 25 Jan 2023 04:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234572AbjAYEEX (ORCPT ); Tue, 24 Jan 2023 23:04:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233948AbjAYEEL (ORCPT ); Tue, 24 Jan 2023 23:04:11 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F40AA49571 for ; Tue, 24 Jan 2023 20:04:04 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id e19-20020a05600c439300b003db1cac0c1fso375193wmn.5 for ; Tue, 24 Jan 2023 20:04:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=j7RF0qTOfHHMDu60U4Twpx8Fq0h2vhCI+J671zGZT5Y=; b=drjZeukjxcYUwNy5Rr3Y3wiLiNmlUJuw4ZME/2je9d6FVJuicAJK3lzXJdg+Hyefc2 YOlAH2m/K6dWaIFgcQRXu3OG5m+nztZfDKSqDYnZjVctGI64MAzA12E+G4hp0j8D2EF8 OnV2NiQbM/Wiyfmpcvmc6WiCqO4aqdGrCtrZWfyzHyPy/6uiCybMJTR2qyWUdcUbFMRF EY2LZ0VRvel4XK59DBZMXm8cQQoxIYnshs4ovrAQkdmi9X9w8r8ms/7FSFsViyUm6C0b B+plJrdKIy3lpyRimRyz5/PQDuvYX4KQJLOasJjjqs0cn/SZk89UWCljCViKuIiVyTmx LVJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j7RF0qTOfHHMDu60U4Twpx8Fq0h2vhCI+J671zGZT5Y=; b=p1JZzw1Xz/8u92u7unEFO/5Y9CJM4XnTHmwSWjJ9fIKpF/5i0gNN7nQNeeNNRhLCp0 E7WYer44fpCetewQwPtgbpF4PQAlzaugj2zBPVtfA5XDYGgh1WYmbIG0gsp3hGAmAsTR l0vbYxHYqogAkfGUQUtB+HDn6xscwu53QTGGFjKC3WYX5RkDVxmdCzcnSbn/YLF7RBDI zlHEqj5YxLmThnnxf0EdeCRwAdtPlBdg0LBYkt84daA2qisLTSFYllCznJA4lgSEvPn5 d9QwuLrP62ZDgUdr5PBVpsQ5nTaM2CRpicLFZGqsfVIaEuGQyhGPj7RsQdmLTKy/73kj pNdQ== X-Gm-Message-State: AFqh2krQo9Bc46CIGDJk55MbG+LcZyskcFt8g72/D1YjT2MVHninYqlq kdtXCyzLa5K7GB3i2gh4jjbGiWdgAt0= X-Google-Smtp-Source: AMrXdXtEkawgCpfoEdRHp1tZkeR7WRHon/uGaCEXsVArkU2zEjn09wdsgXyh6b+bVutOkz4KDZ29NQ== X-Received: by 2002:a05:600c:34d0:b0:3db:2647:a012 with SMTP id d16-20020a05600c34d000b003db2647a012mr21270287wmq.40.1674619443347; Tue, 24 Jan 2023 20:04:03 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i11-20020a05600c2d8b00b003db305bece4sm501298wmg.45.2023.01.24.20.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:04:03 -0800 (PST) Message-Id: <0d0541ea243faaf8ae9df80f7caf64a8e7f80292.1674619434.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:51 +0000 Subject: [PATCH v5 07/10] rebase: clarify the OPT_CMDMODE incompatibilities Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren --edit-todo was documented as being incompatible with any of the options for the apply backend. However, it is also incompatible with any of the options for the merge backend, and is incompatible with any options that are not backend specific as well. The same can be said for --continue, --skip, --abort, --quit, etc. This is already somewhat implicitly covered by the synopsis, but since "[]" in the first two variants are vague it might be easy to miss this. That might not be a big deal, but since the rebase manpage has to spend so much verbiage about incompatibility of options, making a separate section for these options that are incompatible with everything else seems clearer. Do that, and remove the needless inclusion of --edit-todo in the explicit incompatibility list. Signed-off-by: Elijah Newren --- Documentation/git-rebase.txt | 61 +++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 8a09f12d897..d2b731bd605 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -208,6 +208,39 @@ Alternatively, you can undo the 'git rebase' with git rebase --abort +MODE OPTIONS +------------ + +The options in this section cannot be used with any other option, +including not with each other: + +--continue:: + Restart the rebasing process after having resolved a merge conflict. + +--skip:: + Restart the rebasing process by skipping the current patch. + +--abort:: + Abort the rebase operation and reset HEAD to the original + branch. If `` was provided when the rebase operation was + started, then `HEAD` will be reset to ``. Otherwise `HEAD` + will be reset to where it was when the rebase operation was + started. + +--quit:: + Abort the rebase operation but `HEAD` is not reset back to the + original branch. The index and working tree are also left + unchanged as a result. If a temporary stash entry was created + using `--autostash`, it will be saved to the stash list. + +--edit-todo:: + Edit the todo list during an interactive rebase. + +--show-current-patch:: + Show the current patch in an interactive rebase or when rebase + is stopped because of conflicts. This is the equivalent of + `git show REBASE_HEAD`. + OPTIONS ------- --onto :: @@ -249,22 +282,6 @@ See also INCOMPATIBLE OPTIONS below. :: Working branch; defaults to `HEAD`. ---continue:: - Restart the rebasing process after having resolved a merge conflict. - ---abort:: - Abort the rebase operation and reset HEAD to the original - branch. If `` was provided when the rebase operation was - started, then `HEAD` will be reset to ``. Otherwise `HEAD` - will be reset to where it was when the rebase operation was - started. - ---quit:: - Abort the rebase operation but `HEAD` is not reset back to the - original branch. The index and working tree are also left - unchanged as a result. If a temporary stash entry was created - using `--autostash`, it will be saved to the stash list. - --apply:: Use applying strategies to rebase (calling `git-am` internally). This option may become a no-op in the future @@ -345,17 +362,6 @@ See also INCOMPATIBLE OPTIONS below. + See also INCOMPATIBLE OPTIONS below. ---skip:: - Restart the rebasing process by skipping the current patch. - ---edit-todo:: - Edit the todo list during an interactive rebase. - ---show-current-patch:: - Show the current patch in an interactive rebase or when rebase - is stopped because of conflicts. This is the equivalent of - `git show REBASE_HEAD`. - -m:: --merge:: Using merging strategies to rebase (default). @@ -651,7 +657,6 @@ are incompatible with the following options: * --no-keep-empty * --empty= * --[no-]reapply-cherry-picks when used without --keep-base - * --edit-todo * --update-refs * --root when used without --onto From patchwork Wed Jan 25 04:03:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A744AC27C76 for ; Wed, 25 Jan 2023 04:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234420AbjAYEEU (ORCPT ); Tue, 24 Jan 2023 23:04:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233898AbjAYEEG (ORCPT ); Tue, 24 Jan 2023 23:04:06 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E48A49436 for ; Tue, 24 Jan 2023 20:04:05 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id t18so2959911wro.1 for ; Tue, 24 Jan 2023 20:04:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=/HIysfdBGbaJ/TZH6tgJAnmrhdRdwbDIiLBz1fX6tjU=; b=FoSkjOpDViWgi/7R0IagNa6lWxdWxQMBWTlrWjYGU5GiPw7L1h7WwsPQOSbRQp5MLa wY6kaI+/ry8k1Uq4dAjol5p42yjTU7/YaqIetKJqrLc16cpg6QuHyKQGeyhYbxhITouF IMVnEAW2+bTvQZSt0Zx/k+mCrkJ8+Nz/qBBDDHqjR7KyOIHNqX5wWK0vyiIQw+qlOHd3 JLJVmbLKkpOUkS511GqChTGE+Y4h/UrxHb8J4MNiPQS67inQ5YWFfndwv1Q2u857a9a+ qOcjU8zZxr8ZcSE0V7uPONMmnbRFelG95TT5WuDLBqnRcqfQgNa9JWwW0vi7Bx0747kp YqDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/HIysfdBGbaJ/TZH6tgJAnmrhdRdwbDIiLBz1fX6tjU=; b=BEZneBCmoSPvYedvi/6GCpJAvcie31/cXbHhyOqFQKEToZOuvpWISEDvweEsOVOZEy BKYGoZ62l70qU65FhIg+aYc0VNeI+VqGOrzAvENPZ3kv1PsuUEe1pRdHtbvDSgRTMFBt axihSQQNX27+nx5GaCrl1G9s1nngUyipiPaOL230ux8rmAN0Tu9kpf88d04UHBxNyYEh YsfO7Nw08qPIHmSFYNqVbszB80gCjixJQn3Vh2yv3Fs4Z/IPIT/FVZ0hhsjTX1huzIJk sulNeJxWWjMk6K1uJ8NaJ1H7A05DGR7TfW2HRcJfeGFig0JJfj5ajJ93k/82qP/KIjU1 9DTg== X-Gm-Message-State: AFqh2kpS2ablITsiJkNvcywNSvJ4yoyYHduGFDuLewF96AsrUxYiuy5q +rZe2qeDYWqFNX/iLcpen6EnBdhibsI= X-Google-Smtp-Source: AMrXdXuMpHIRZUbuvBkCdnbf/K2txRWrCV3HLMyRydjrWDL7NgKlXPi5hQmdPHC4eg/icg8UOLaKmA== X-Received: by 2002:adf:ee8d:0:b0:2bf:95cc:744f with SMTP id b13-20020adfee8d000000b002bf95cc744fmr15037170wro.56.1674619444177; Tue, 24 Jan 2023 20:04:04 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n6-20020a5d4c46000000b002bbb2d43f65sm3240143wrt.14.2023.01.24.20.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:04:03 -0800 (PST) Message-Id: <01808cf84a887b8ec3cb7e3fd01e7ea363a1d0c9.1674619434.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:52 +0000 Subject: [PATCH v5 08/10] rebase: fix formatting of rebase --reapply-cherry-picks option in docs Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Commit ce5238a690 ("rebase --keep-base: imply --reapply-cherry-picks", 2022-10-17) accidentally added some blank lines that cause extra paragraphs about --reapply-cherry-picks to be considered not part of the documentation of that option. Remove the blank lines to make it clear we are still discussing --reapply-cherry-picks. Signed-off-by: Elijah Newren --- Documentation/git-rebase.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index d2b731bd605..99aadac28ef 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -338,7 +338,6 @@ See also INCOMPATIBLE OPTIONS below. upstream changes, the behavior towards them is controlled by the `--empty` flag.) + - In the absence of `--keep-base` (or if `--no-reapply-cherry-picks` is given), these commits will be automatically dropped. Because this necessitates reading all upstream commits, this can be expensive in @@ -347,7 +346,6 @@ read. When using the 'merge' backend, warnings will be issued for each dropped commit (unless `--quiet` is given). Advice will also be issued unless `advice.skippedCherryPicks` is set to false (see linkgit:git-config[1]). - + `--reapply-cherry-picks` allows rebase to forgo reading all upstream commits, potentially improving performance. From patchwork Wed Jan 25 04:03:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2905DC54EAA for ; Wed, 25 Jan 2023 04:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234585AbjAYEEZ (ORCPT ); Tue, 24 Jan 2023 23:04:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234138AbjAYEEM (ORCPT ); Tue, 24 Jan 2023 23:04:12 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D63674997D for ; Tue, 24 Jan 2023 20:04:07 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id n7so15773374wrx.5 for ; Tue, 24 Jan 2023 20:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=6lRB6TfgwlHpAlpY1phqfYBxeXsom1nztOw6cHxhoxg=; b=PFFH69hDJuCvcobmtC0nxqaiVt3BjVJgKHpe6+m+jUObDS6Nl9lwRQDSzPEsguWPQc B3l5isWUwZG7D6Xr/usWeSvyd1dfEaXEd3rcUaIrJEAQey1YpQsL3YR1EMoZ2QGscUmp A+z0r76C9Phth2dx4AIIzwubbbTaRQ7xlCXZoA2mrPuUGP0vXVvzSD/6w+Xj78t/8HXv b615c0i5TSTlNTKIvvhQQwZXCAbOS0qc0KFQx7j0L9RNGzFIBst2hsRec2suoeRS3iul ZqYxuXnVtxElFXRd3CE3UlVAyYLEE6MleNNLG5pWR6+CQPCP63zN53GeTkweX1w+jdvW zOiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6lRB6TfgwlHpAlpY1phqfYBxeXsom1nztOw6cHxhoxg=; b=sgvqbqvcLw58aRvNPWa8IbGjhddBQZ+qAMbhx2ufsQ9wJCwjmnvBvuJ2C6HFy04T2E M6IHg16797jIJVcCG3NVeTOTgE8h28zgP5HB0yJIQL9rn6U2BQaEOlV2350m392+mudt xwQmFc3wvgC2b6F44b7aeA3ZJCl//9T3GriXqxW/rlJEO3RKZnu1JF2417lfrdbyhmUK 46JgUBdU9yFENFuJfRgjTURnyUd7sJovmpZ1td7VCMb7FXD1bNQqTn4QXPoMyvH+oMpW z4pXy/f0EVkN5XQ9++aIg3dOV4eFlZiYuvtz9MK6PYR9+7dvAObYChdiCg5BEUyU8EIz RHnQ== X-Gm-Message-State: AFqh2kqAL4CkaZXAGSyyiLGbR8TyJ0CCW1z7DOB2mCo1pG983Di6gc36 leXA0x/nXb7/H1pBsxKfFZgpGgEPhXk= X-Google-Smtp-Source: AMrXdXvi5eI+aW9g41NTK6E/CQ+qk83PvsaxFZYkE+6GA4/a7+x99gC2oSxTugqiMvYnYdrPR8IDLw== X-Received: by 2002:a5d:620a:0:b0:2bb:6b92:d4cc with SMTP id y10-20020a5d620a000000b002bb6b92d4ccmr23776944wru.53.1674619445722; Tue, 24 Jan 2023 20:04:05 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x18-20020a5d4912000000b002be099f78c0sm3316985wrq.69.2023.01.24.20.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:04:04 -0800 (PST) Message-Id: In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:53 +0000 Subject: [PATCH v5 09/10] rebase: put rebase_options initialization in single place Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren Signed-off-by: Elijah Newren --- builtin/rebase.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index d6b20a6a536..ad5ebecbbdb 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -134,6 +134,8 @@ struct rebase_options { .exec = STRING_LIST_INIT_NODUP, \ .git_format_patch_opt = STRBUF_INIT, \ .fork_point = -1, \ + .reapply_cherry_picks = -1, \ + .allow_empty_message = 1, \ } static struct replay_opts get_replay_opts(const struct rebase_options *opts) @@ -1158,8 +1160,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) prepare_repo_settings(the_repository); the_repository->settings.command_requires_full_index = 0; - options.reapply_cherry_picks = -1; - options.allow_empty_message = 1; git_config(rebase_config, &options); /* options.gpg_sign_opt will be either "-S" or NULL */ gpg_sign = options.gpg_sign_opt ? "" : NULL; From patchwork Wed Jan 25 04:03:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13114998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37A87C61DA0 for ; Wed, 25 Jan 2023 04:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234644AbjAYEE1 (ORCPT ); Tue, 24 Jan 2023 23:04:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234361AbjAYEEN (ORCPT ); Tue, 24 Jan 2023 23:04:13 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1DB04AA40 for ; Tue, 24 Jan 2023 20:04:08 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id e19-20020a05600c439300b003db1cac0c1fso375242wmn.5 for ; Tue, 24 Jan 2023 20:04:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=tJ7NILSD4/Y/i4ydLhrXOqJ6DVvf6Azb/dVXvgpy4t0=; b=GXJ3QWlVBGaTeWBj2aU3unywJaqoWqGNcKkyXBet/P4WPq1wOL5Fkw+o2FgifhM001 1qILme+YB11AZ2Vp2trVKmXCKnoWViyioma3g5OUYXFrTbTY+a2uCJNPgF6obW9100YA 9QjNv4kKAIwMZ1QL2oMqMMUpeV05GwYv1Ebm1mjAtKnTjSSabagXdCM4vWm1xrQ/UQLe m2sGYv7zMpE7BR8xLnFalEkKI51yHE2yAyzJ7AXHiYTFLbnwcWZrc84xW0Iqo+koizfK tvnGpchtBi0SMi0IKzJEAMlyqp7dXWTw7AwCXNJw/mL2fnbjgNV+E1V4O+ALf46XZX5f EEHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tJ7NILSD4/Y/i4ydLhrXOqJ6DVvf6Azb/dVXvgpy4t0=; b=J1AIYvwX3AyQOjVDNJNkb2MGJ+LBoSaU47sPowlHRa8wDKqqVx664reZpN9jhkKoMR yAM1bwtCyAbEGZpv1LxDJDAk0eLGKxRY2MgYyb4BjroeiMKeeOf527CUBiNYwaFFE5KW knOn7nmcim7aHS9RASVtNA/yrXjfUQbgzvqKjWwWbxoTl7oEV+siZIWYE3aVvv5IcjD+ CrKCrfATeB1xla1LZ2mPj5KLuyDLjm2GZsZYCf2Mpun/hAXYN9b8ef/M+/YO4kGvDe3y sKdBMNVYAGe0ohCwnOdpt0jKLO6Uoj9jzuMpYVY3cP03DveSfaiSttqu9jbcLG4FTTh2 h1Iw== X-Gm-Message-State: AFqh2kqMpOHBCLqSvU8zB0cEBqdWynNwijGKIgOnz/erhOVQxMiESs8g XZc4O5GH5yNJPuJL2hjNoQFKqoAELSE= X-Google-Smtp-Source: AMrXdXuESSsEdZuuJsKNjfQvsnEmo1pzZjgHhw0g0cruLx0/794sAIGQMQS8tffkqGrr5eBE8EkGUA== X-Received: by 2002:a05:600c:3b84:b0:3da:fd7c:98b3 with SMTP id n4-20020a05600c3b8400b003dafd7c98b3mr29836744wms.25.1674619446738; Tue, 24 Jan 2023 20:04:06 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l16-20020a7bc350000000b003d9aa76dc6asm736294wmj.0.2023.01.24.20.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 20:04:06 -0800 (PST) Message-Id: <328f5a1d534dca2998785d1fad555e3645bc2c81.1674619434.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 25 Jan 2023 04:03:54 +0000 Subject: [PATCH v5 10/10] rebase: provide better error message for apply options vs. merge config Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Derrick Stolee , Elijah Newren , Eric Sunshine , Martin =?utf-8?b?w4VncmVu?= , Phillip Wood , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren From: Elijah Newren When config which selects the merge backend (currently, rebase.autosquash=true or rebase.updateRefs=true) conflicts with other options on the command line (such as --whitespace=fix), make the error message specifically call out the config option and specify how to override that config option on the command line. Signed-off-by: Elijah Newren --- Documentation/git-rebase.txt | 2 +- builtin/rebase.c | 27 ++++++++++++++++++++------ t/t3422-rebase-incompatible-options.sh | 24 +++++++++++++++++++++++ 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 99aadac28ef..9a295bcee45 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -648,7 +648,7 @@ are incompatible with the following options: * --merge * --strategy * --strategy-option - * --[no-]autosquash + * --autosquash * --rebase-merges * --interactive * --exec diff --git a/builtin/rebase.c b/builtin/rebase.c index ad5ebecbbdb..7171be40eeb 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -122,6 +122,8 @@ struct rebase_options { int reapply_cherry_picks; int fork_point; int update_refs; + int config_autosquash; + int config_update_refs; }; #define REBASE_OPTIONS_INIT { \ @@ -136,6 +138,10 @@ struct rebase_options { .fork_point = -1, \ .reapply_cherry_picks = -1, \ .allow_empty_message = 1, \ + .autosquash = -1, \ + .config_autosquash = -1, \ + .update_refs = -1, \ + .config_update_refs = -1, \ } static struct replay_opts get_replay_opts(const struct rebase_options *opts) @@ -778,7 +784,7 @@ static int rebase_config(const char *var, const char *value, void *data) } if (!strcmp(var, "rebase.autosquash")) { - opts->autosquash = git_config_bool(var, value); + opts->config_autosquash = git_config_bool(var, value); return 0; } @@ -795,7 +801,7 @@ static int rebase_config(const char *var, const char *value, void *data) } if (!strcmp(var, "rebase.updaterefs")) { - opts->update_refs = git_config_bool(var, value); + opts->config_update_refs = git_config_bool(var, value); return 0; } @@ -1366,7 +1372,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if ((options.flags & REBASE_INTERACTIVE_EXPLICIT) || (options.action != ACTION_NONE) || (options.exec.nr > 0) || - options.autosquash) { + (options.autosquash == -1 && options.config_autosquash == 1) || + options.autosquash == 1) { allow_preemptive_ff = 0; } if (options.committer_date_is_author_date || options.ignore_date) @@ -1499,20 +1506,28 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if (strcmp(options.git_am_opts.v[i], "-q")) break; - if (i >= 0) { + if (i >= 0 || options.type == REBASE_APPLY) { if (is_merge(&options)) die(_("apply options and merge options " "cannot be used together")); + else if (options.autosquash == -1 && options.config_autosquash == 1) + die(_("apply options are incompatible with rebase.autosquash. Consider adding --no-autosquash")); + else if (options.update_refs == -1 && options.config_update_refs == 1) + die(_("apply options are incompatible with rebase.updateRefs. Consider adding --no-update-refs")); else options.type = REBASE_APPLY; } } - if (options.update_refs) + if (options.update_refs == 1) imply_merge(&options, "--update-refs"); + options.update_refs = (options.update_refs >= 0) ? options.update_refs : + ((options.config_update_refs >= 0) ? options.config_update_refs : 0); - if (options.autosquash) + if (options.autosquash == 1) imply_merge(&options, "--autosquash"); + options.autosquash = (options.autosquash >= 0) ? options.autosquash : + ((options.config_autosquash >= 0) ? options.config_autosquash : 0); if (options.type == REBASE_UNSPECIFIED) { if (!strcmp(options.default_backend, "merge")) diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh index 6a17b571ec7..4711b37a288 100755 --- a/t/t3422-rebase-incompatible-options.sh +++ b/t/t3422-rebase-incompatible-options.sh @@ -94,6 +94,30 @@ test_rebase_am_only () { git checkout B^0 && test_must_fail git rebase $opt --root A " + + test_expect_success "$opt incompatible with rebase.autosquash" " + git checkout B^0 && + test_must_fail git -c rebase.autosquash=true rebase $opt A 2>err && + grep -e --no-autosquash err + " + + test_expect_success "$opt incompatible with rebase.updateRefs" " + git checkout B^0 && + test_must_fail git -c rebase.updateRefs=true rebase $opt A 2>err && + grep -e --no-update-refs err + " + + test_expect_success "$opt okay with overridden rebase.autosquash" " + test_when_finished \"git reset --hard B^0\" && + git checkout B^0 && + git -c rebase.autosquash=true rebase --no-autosquash $opt A + " + + test_expect_success "$opt okay with overridden rebase.updateRefs" " + test_when_finished \"git reset --hard B^0\" && + git checkout B^0 && + git -c rebase.updateRefs=true rebase --no-update-refs $opt A + " } # Check options which imply --apply