From patchwork Sun Jan 22 06:12:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13111408 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 04602C54EB4 for ; Sun, 22 Jan 2023 06:13:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229622AbjAVGMu (ORCPT ); Sun, 22 Jan 2023 01:12:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjAVGMs (ORCPT ); Sun, 22 Jan 2023 01:12:48 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4520DD51D for ; Sat, 21 Jan 2023 22:12:45 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id fl11-20020a05600c0b8b00b003daf72fc844so8508452wmb.0 for ; Sat, 21 Jan 2023 22:12:45 -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=VzfTzxpeK+rnCv+aixXORg/zSfyVvpHJW5ZAREJLflDpk5CGh9fBHvsDXkmlcuYagz hUoX7RIqTB4JCUW3406R5NFNtGTLbWxortNWbthLFxBhMgdNC439VHhXgUx37E0LNrv4 msUz/JY+v91pRhr7PHDaUkgkqkAX51rUVTzQiT3mPap7TkECgW6E4FSP7pAY67y+Svrc fN0+yX9pNC8DbebCxIufAlw+K/eM7Vi9fOJaUZhVUIpXXjekqPEArnQzu2uVSRcN4Aq/ +wgyiW8iVrqyFfbdOCxJ5g7XDOB7QcKpZbqHw6IA0++HFhIkfbd6oOEfmMjvxziZCgXN zjeQ== 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=Frgsw4TuuoL6x6Ad4A0b+Il6gdpubmhSYq4bC9Fv0ikeJv9i5dg75xvHJMAEXOkPhE bOGf2peXlSUyW1puoNrYfsdsNtnvCqcRbtZg23uiUD2xczHySDGBq3jJrLhc+PyN4oau CTIEUWTzYOpQMSkPEElgV6tDKEYnlsM08sprb1Srjmo4WYJpO6bn0xYW2sr7/MuUdN0s CAIZb9u0sTC0+eSm8826QpmeHrSUY7H8jDJOlUW5yqu3UbDGH/9r6Wq25jlo3Mr4VOUl JKEPYkQCfnSLK+NLaRii/+0G1ctBBzkcwaRFdipAATINrCquAg3zS5c/JK6aeMaYzGrN v9gA== X-Gm-Message-State: AFqh2krDjwE1LoW2y7RWlqY8ASfFO4jyxpcD/ZUDazzRoTOgep/YwsXs PNwVlpn+8S1k4uMe0KwCpi1bFA7WAsg= X-Google-Smtp-Source: AMrXdXvNQjKNj9DckQTNorTQxRDNQXrlAcNdF4qy71bPNQ4ZDSFsQrnULBWz4JUX7a+LTWw8PGP1nA== X-Received: by 2002:a05:600c:d2:b0:3da:f475:6480 with SMTP id u18-20020a05600c00d200b003daf4756480mr19746361wmm.7.1674367963498; Sat, 21 Jan 2023 22:12:43 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x15-20020a05600c188f00b003db122d5ac2sm6742384wmp.15.2023.01.21.22.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 22:12:42 -0800 (PST) Message-Id: <8a676e6ec1a30a0220ca0d222211a4cdbf0646a2.1674367961.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 22 Jan 2023 06:12:32 +0000 Subject: [PATCH v4 1/9] 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 Sun Jan 22 06:12:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13111405 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 D302AC54E94 for ; Sun, 22 Jan 2023 06:13:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229744AbjAVGMy (ORCPT ); Sun, 22 Jan 2023 01:12:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbjAVGMu (ORCPT ); Sun, 22 Jan 2023 01:12:50 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 032DBE05C for ; Sat, 21 Jan 2023 22:12:45 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id l41-20020a05600c1d2900b003daf986faaeso6381262wms.3 for ; Sat, 21 Jan 2023 22:12:45 -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=mEY6h8zZvi05BL7RRSRt0SHiT1BAlIcsUD85cRCeLi4QsMWkgAMURiSDPHJmfzx1qc SJJ/hlB1dgC52wdDlEC7A9HVZu6bU4zD0CoxiSkBAqwG3YjScNooyxzjNDYVfv3f1Ppt D+yu4KDEUoP8aIdCrPMPpnpUEakI4DwFrAexq/BOOHPwUd09L4YexnkfPs+i8f0EnUJl AhP/9HvWuXpLOTeYZBfJ4K4j/gIB5PBz/kC/MWGP9D7vhmTP54CLEzuJfzT5JBFj5yi/ XwR80a7sM/A8v50FVO/uU2pHVL8RvT9vZiUVeXJpMBNABAjfsge/SWtAhbxlYrGTxQ1i gBnQ== 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=KmhGOEq/4XersmCo6Mun3hTetBNg41u00fHtSVhcTdAYg/5Aj0joQcW2GuG+zd2yry rbI5eLy/DsB9HY/xzyoanp0izzFH6wUIvsj0d5vXobtvVQk3chQ2oHX9TCc1gceoVcQv TF6G/YC+bpqimCo82cHkyt2kdHIy4BGe/axxU7JtJ2tnAXKsvBQrYxmZW3ytJQgnH+zb UwIcqIeSwhjNYrlW72zhUCKtsi9eMlgZPz7dIZDpGdofrNEx4wRKF0fbuVSTTuFD7hf2 WvuZZNdDxt2+rorETKqexQ0fBAJ5/SQ2p6dn3A4OqWKgffa7XCC/RGwZf1TR8dsq8l2P vUFw== X-Gm-Message-State: AFqh2krbZLL9gtxwbTLkB0c4Ob9QkkQp4oyYStD4VIz1Ygoz3K0ko6v9 RK0LDNrphdYRj6cpeXiYhQzGfoseUyY= X-Google-Smtp-Source: AMrXdXsIB1QsjTZj32axtoLhDVsbIKxI4kinTGzh0U5GtFzLU4UE4ImoKZ+ijbM4Y5uYkCpBZ6cTzQ== X-Received: by 2002:a1c:f617:0:b0:3d2:191d:2420 with SMTP id w23-20020a1cf617000000b003d2191d2420mr18837484wmc.7.1674367964374; Sat, 21 Jan 2023 22:12:44 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id hg8-20020a05600c538800b003d974076f13sm6971985wmb.3.2023.01.21.22.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 22:12:44 -0800 (PST) Message-Id: In-Reply-To: References: Date: Sun, 22 Jan 2023 06:12:33 +0000 Subject: [PATCH v4 2/9] 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 Sun Jan 22 06:12:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13111407 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 395ADC61D97 for ; Sun, 22 Jan 2023 06:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229751AbjAVGMz (ORCPT ); Sun, 22 Jan 2023 01:12:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbjAVGMu (ORCPT ); Sun, 22 Jan 2023 01:12:50 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B94FAF761 for ; Sat, 21 Jan 2023 22:12:46 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id b7so8127974wrt.3 for ; Sat, 21 Jan 2023 22:12:46 -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=PoaHgnfta+wgsGrqTNaCmUbg/pSTdLXF/a4Gs19V2I8AZygCPJJAO34d9sgcrzzgRv BQMWV85VpZxQLc851NlATQRt8rB5T8n6DvtrQxj/tiaFm8UEjkCsoFQ1989V6S6B2naK IaxHf+eNZz9jHQVsV4yqLc3v9wZXLwUk5V02kWii4s90cdtlXwIaUyrlq8agqae0uTtM IlbTEM39DW6JkPOIK7u1+pjx/Zt08gXBAFNjwtReyWXaNFjAETSzuI+FjtHrWEQTcnno teMH0C6ch3ksuHUIr2lubAgYSb3+51h07slOP8sqNK+EwD87h/QCtcT3W3Evn0/S0ng/ Rt+A== 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=InQriW2iMDFU4/2K3JrWF/rvtXh2djeujIbPUguEzo3QqWjyLtFf3crVSoebmllVRL hUYOTivSLwev6dX3QcgfXa6iV/SqbbUYKkQkf0pO3sxEF/ym1A8ORhE8ZJpiGnRrfH0l uS/ZGotX0bpcFADn7CkF/5cccEM/yWKvL4sVvyyvdAx0bao3A77nQ2hzQ6w6NorSPU2Y hIrnqgxb5PkmQnVGAYvTbwuzbc0c+1uuJclakAXM9DR1zvdnItkuaXCfy/uSE9rFs/+N QdCXS2PpuV/is9dggWLRI8QW7KB/okl+10cVKNmzBEP7L0zm22cNMnEHgFZMbT8eHO5s HGyQ== X-Gm-Message-State: AFqh2krAGwAp768RpsBoJjD8DS1NTFs3vjMV1qGcKdf9fBktYbN1GK/O Hzxm/p8wH3pPrx7dInsB4hZfWLTmqKU= X-Google-Smtp-Source: AMrXdXutg/7F7qla476mqg5MnXuRcRQ8Jm0yPtGwWntb3BiK4yXK0DUYGoblAMohw8uA3571gIKlJg== X-Received: by 2002:a5d:5190:0:b0:2bd:fde4:885c with SMTP id k16-20020a5d5190000000b002bdfde4885cmr15952480wrv.63.1674367965043; Sat, 21 Jan 2023 22:12:45 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c14-20020adfa30e000000b002be50604c81sm6125513wrb.47.2023.01.21.22.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 22:12:44 -0800 (PST) Message-Id: <9464bbbe9ba60927a3c36ac9685545447744819c.1674367961.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 22 Jan 2023 06:12:34 +0000 Subject: [PATCH v4 3/9] 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 Sun Jan 22 06:12:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13111412 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 982EFC61DA0 for ; Sun, 22 Jan 2023 06:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229735AbjAVGMx (ORCPT ); Sun, 22 Jan 2023 01:12:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229644AbjAVGMu (ORCPT ); Sun, 22 Jan 2023 01:12:50 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94944FF0C for ; Sat, 21 Jan 2023 22:12:47 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id r9so8118423wrw.4 for ; Sat, 21 Jan 2023 22:12:47 -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=jSMUgqUqsjeQr9PZwcNNA/NnUdbLACAUakD2AAsu81W3AGNwOH1eGYZvEUQzHVyz5V kNEJK2bOD8h6dFCIGAGvQA0bdPW+DB0U9avew23SmT2ZtIY/aW4I6a/u4u7PUu5VPRPv SDYmQ4mmJUKUPO8HsW7nyzrlpNuQ8qdwR/6BX72wuqQ/Y5TXObCeN55mTEz0mbyjiuRs IRQMmgDAihBV5voPfUcfhGxTw55Q40NlWo/9xnb2AF97mlrpEryehvIGGDMIbGCOv2h5 WBbroY5RQqM7E7meMamCMHNcyHV4nKCIhLs6aHDMGNFa5poY4PHKyV2soJUsxrFykyTV 5Dvw== 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=C/7NwNz++Sh6Hu8e9BBaxP/mvXIPaPUG4zhZXObw0iBRVnJ9fwwCfXWQD893TqwJG5 z8q8oak1WnyR7/Y34fhb9TeVvSggbgHRezOMO39cNxFxg0lfyVMx9QBGSsFUJNTWP9Lo LRgE5vh/z2eXGk+XgqtDtws/OUhRUvWdac1aPyVN3v0Tfo7KDnxXfKvs2a17i0gpiR4+ ra+QlgnoOzux2pOAmHjEXC037Xs/vncQpyD2p7ropwOthsxKbPnppPOeNTXIiCRqvswH j4wkhQlUUqpePYPVcUwiucAsKf1eq2+uvGmFAkVtx7N2J5t1zhZPUckB6iOmTVSOAeTo qO1g== X-Gm-Message-State: AFqh2krOvkYojD9BCi6SHsj3OENKyLWh1sF6iTKNK+wWIGLwwhSl8y7L zhUV5Jk/NNTcZQBDKmPSIDuhcrdbbIs= X-Google-Smtp-Source: AMrXdXuJnunDPG4P34wGpRNwT528KThWG0ZF3VSh3XWplAOg9tQIGC50nRzNRIZX7YUzF/qqcDJjBQ== X-Received: by 2002:a5d:6b42:0:b0:2bc:bffe:831a with SMTP id x2-20020a5d6b42000000b002bcbffe831amr12198662wrw.49.1674367965819; Sat, 21 Jan 2023 22:12:45 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j7-20020a5d4487000000b002425be3c9e2sm1866676wrq.60.2023.01.21.22.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 22:12:45 -0800 (PST) Message-Id: In-Reply-To: References: Date: Sun, 22 Jan 2023 06:12:35 +0000 Subject: [PATCH v4 4/9] 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 Sun Jan 22 06:12:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13111410 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 17636C54EAA for ; Sun, 22 Jan 2023 06:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229760AbjAVGM4 (ORCPT ); Sun, 22 Jan 2023 01:12:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjAVGMu (ORCPT ); Sun, 22 Jan 2023 01:12:50 -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 2E0BBE042 for ; Sat, 21 Jan 2023 22:12:48 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id h16so8090335wrz.12 for ; Sat, 21 Jan 2023 22:12:48 -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=VFvzF6UR03HbaAWyeb/n/Q2ty+F5DZ4Dij7qzifqrfI=; b=FNhIFuHKuXSfhHvL1z4itAzUzd1pGAw2/mtWJQ5S5CJuysLNci11rJ5Dkn30Ho/EXR I/qIns+q3rJsUdxItXMDTsTrXgg8mAdg51zbj28MYUmh5nV6cwiZI+qRMs8jogdSLlxt b8wsl/dE/3NNQacuWlfz7ir+7vJGdCXRe6J5fv6ClBT/d1v686WBpy7XvHcbZUZWOmie brP1XZVCwIkJhXi1RTLW/543+rJexNkmQgEbpjcxyQdQzEQaVPEk4IUGau6hKOqOobxl i7/oGtL/gQ/87SrUntlgGUsjhK6o9yFxCK4zxG2/u+8j+OiTMTmEA1USSeshta+GWGTX U4/A== 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=VFvzF6UR03HbaAWyeb/n/Q2ty+F5DZ4Dij7qzifqrfI=; b=fsvAy013+yGeFRXlbFeNJEyw9zQNgxMADy2V5cVgjZ6uVXIJelS+uxaFhBt/AKCPRJ 6y7ROMhmuPO5qSKscwz3T0tJk6t3BlyxLCkQ7TYrAr91GBZIS+XavS3WYc5e+BlPFvC5 bWeBOxjJroCyPhpBEE39M1GK2Sd2wDygToi0qg43ivA5jlr5UjXoHoHaXRhurltnFNI3 n7GxNHxSVmKTB+6mOmOkWvKrQ8yBsN0N1p2GaPEKJtjEeJpRN78M9k/JcwlNccZJAvUP A1WFLfVvwPBLrCw64CJu6fa5VmhpkufFNaW85rcjIozEnIOMgsbKdRbSZsiNDXJ/6aAf Qg2g== X-Gm-Message-State: AFqh2krhcrDDyrIZPpOY4xXKHXsO7t/yi9Pl9s2Hhy1N+KN7Ib1uhZ1m yeNU6jZ7ou9Pt7RfWLrfUiOXHnvtKjw= X-Google-Smtp-Source: AMrXdXsaRQlMnGEZnpnUrapAVfyi5xmQM5lz+cWHRtfLxQJyhm7u4CejiflYWBGE+o++NW1a7rB4vA== X-Received: by 2002:a5d:5182:0:b0:242:4697:d826 with SMTP id k2-20020a5d5182000000b002424697d826mr17568146wrv.29.1674367966540; Sat, 21 Jan 2023 22:12:46 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id w4-20020adfee44000000b002ba2646fd30sm2371089wro.36.2023.01.21.22.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 22:12:46 -0800 (PST) Message-Id: <5e4851e611ee18112bd71939ee900e02a8d590c5.1674367961.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 22 Jan 2023 06:12:36 +0000 Subject: [PATCH v4 5/9] 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 some 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 --- Documentation/git-rebase.txt | 2 +- builtin/rebase.c | 30 ++++++++++++++++++++------ t/t3422-rebase-incompatible-options.sh | 25 +++++++++++++++++++++ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 846aeed1b69..8cb075b2bdb 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 * --edit-todo * --update-refs * --root when used without --onto diff --git a/builtin/rebase.c b/builtin/rebase.c index b742cc8fb5c..ed7475804cb 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1224,6 +1224,26 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) if (options.fork_point < 0) options.fork_point = 0; } + /* + * The apply backend does not support --[no-]reapply-cherry-picks. + * The behavior it implements by default is equivalent to + * --no-reapply-cherry-picks (due to passing --cherry-picks to + * format-patch), but --keep-base alters the upstream such that no + * cherry-picks can be found (effectively making it act like + * --reapply-cherry-picks). + * + * Now, if the user does specify --[no-]reapply-cherry-picks, but + * does so in such a way that options.reapply_cherry_picks == + * keep_base, then the behavior they get will match what they + * expect despite options.reapply_cherry_picks being ignored. We + * could just allow the flag in that case, but it seems better to + * just alert the user that they've specified a flag that the + * backend ignores. + */ + if (options.reapply_cherry_picks >= 0) + imply_merge(&options, options.reapply_cherry_picks ? "--reapply-cherry-picks" : + "--no-reapply-cherry-picks"); + /* * --keep-base defaults to --reapply-cherry-picks to avoid losing * commits when using this option. @@ -1406,13 +1426,6 @@ 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 (gpg_sign) options.gpg_sign_opt = xstrfmt("-S%s", gpg_sign); @@ -1503,6 +1516,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 f86274990b0..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,26 @@ 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 + " + + 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 Sun Jan 22 06:12:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13111414 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 A92E0C61DA4 for ; Sun, 22 Jan 2023 06:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229768AbjAVGM6 (ORCPT ); Sun, 22 Jan 2023 01:12:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjAVGMu (ORCPT ); Sun, 22 Jan 2023 01:12:50 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8D5D1814F for ; Sat, 21 Jan 2023 22:12:48 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id z5so8116294wrt.6 for ; Sat, 21 Jan 2023 22:12:48 -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=isyLaI5FrrfbWCFJGdKsB+gKlvvPyuhi6UTOdxtkXCc=; b=mpepJos11slS0QKh7uTlnFdTf6NCuEvYOlQYYeIp2LHqzekoc9243lsEzbE7Kqw2R4 bus4AO1ZyZnZX635hzk+IasENYrmu1jqgrlrdFutmgHddNFsTigSFYq3NaZecO1C55iV KY1MvThVPLNS79cYbxGxwVtWTKyQPu9oSC+M7EiUnUA03gWhuK5m9N1eh+g10TxxqS28 qkRj8g+oWacAL/ljwPqPrAfvByQ/322TiptzJgmqQq26iL0KZ7fk2OtTmfL1rSonUa/H NDlr1dcgzlMERnVLMpCGlzPtgpuekcJBL+oa7iJ/tLkro6CVCSDZmaWHpIQ2WmJTQDEd MN5w== 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=isyLaI5FrrfbWCFJGdKsB+gKlvvPyuhi6UTOdxtkXCc=; b=f+3ZrtYHo2c/+HeHDcwXq9ZXdyNhV2NraThaaFdhKFPu/bqebdSN2o2jgWu6r/hx6N mxQ9gLru1EhO7Ihjlx9YWTKnwaV45Szzob28WCGyKHaYiAeJMvb7yrXcKVx/XFmaBmz1 CPHRBLtOHjrhekqKV6pGzriEeloVThbDu7Caw4prUnC9eVkGA+F18IfKTgLsDt4sGnO9 XgJXwnwqgDCB8NptM1JsvSbOxC81zzMe8ktjXw9bJEW73uaZcuK8S1zeLWIjgpA2g/io 5I96OsXIL8INy3gOLyPqhOfhDk046Z9OF/dFNxvxwRxmX0zEXSDgb/sNHeefgsD6FfJy zz6Q== X-Gm-Message-State: AFqh2krB5gi9AlTc+OtBi35hw70t5fHwkmnc5pr6Z8dvKkwBxzt4PhYE qiQinBqBTr5KiLjOy2il83ZjIEAmMpc= X-Google-Smtp-Source: AMrXdXstA3qOGzDcAbLjPkFqtv+37X3R0qFdmnl+XSm3QL00HMT30y9oKKjiKbuNhc2SknqwGfXA0w== X-Received: by 2002:adf:f4cf:0:b0:2bf:95c0:6b30 with SMTP id h15-20020adff4cf000000b002bf95c06b30mr5342100wrp.31.1674367967227; Sat, 21 Jan 2023 22:12:47 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id w7-20020adfd4c7000000b002baa780f0fasm1923835wrk.111.2023.01.21.22.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 22:12:46 -0800 (PST) Message-Id: <21ae9e053131a9a5f0ddb13fba4bf6502a1d19a6.1674367961.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 22 Jan 2023 06:12:37 +0000 Subject: [PATCH v4 6/9] 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 8cb075b2bdb..1ba691e4c5f 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 - * --edit-todo * --update-refs * --root when used without --onto From patchwork Sun Jan 22 06:12:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13111413 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 86682C61DA2 for ; Sun, 22 Jan 2023 06:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229795AbjAVGM7 (ORCPT ); Sun, 22 Jan 2023 01:12:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjAVGMv (ORCPT ); Sun, 22 Jan 2023 01:12:51 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9376CCDFD for ; Sat, 21 Jan 2023 22:12:49 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id d14so4430288wrr.9 for ; Sat, 21 Jan 2023 22:12:49 -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=RdKGnak+F7uE8hQxj75ON3mmkyVQCQGc9Jht14MetNg=; b=XcUYmMwetNWldntVPO0nFbJAaCZw2udRO54pTl6Rv2e064SkdFpIyaBL2sYZnDFNa1 Up48vMWEkj4SyNOdXXV+03xcvp7dZkInbX9p/XADXaRhU6BMfGNt+NdXLH8eXx6klhGD n++9KV4RB6YLrdkrX97w8oIWaJBY7Yi57KW3XhHm3eby1jV8P2761/YY+rGBaEX7PuqE Z8RLX5Px+fBmGN/Qhh50nS6Qrn/DoJts7y1kz/3tK5JcTAqZhiZ566nVudbTb0vxfrgL IIVCduu6d2ciAtP7XzZ1oyRLRPYJ1JIrF3+arB/GXS4woXQ6xHXQUJzci4uRRXWbgteI la3w== 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=RdKGnak+F7uE8hQxj75ON3mmkyVQCQGc9Jht14MetNg=; b=ek1d+bbuXxXHcEqzNURy4Ms5n8cDMRvYXqy1HOqm1cZ7dBlobrZatxDckvkFvceIbr CZruL2eN1Uy1i5/2wWzZ5O3O7fbtnxnMEH1UHqN+S7pYW5j8UKLeNTZ3r81pVkulht9Q trD+kmSOCuVao24Fvc5uWWu3cxCntTip9pg81exPMMUL4VIdgDgCwgqQ6WlbXMpMUIU+ M3B74+RPFx1lGXgJdptRWsvg+dJT9zCsno8xJWwlyO/PZQhnj/m5Pp8orW2mHS4WrK0r y06dtcSc53VGScIbLiqRqqqA3I3KdrkTLT0uW0X5X+iOFtVSVEtOb3S6mEj5lt0GJhdm Qvbw== X-Gm-Message-State: AFqh2kp4k19Zlrqym+QtY92gRi/Bkx5UGcdUUOIITUreokyxsnHAByHD hpcuTzl3I6Si3wdOMe10setk3YxXAas= X-Google-Smtp-Source: AMrXdXskuiX2mH84IjIaQ2inXnf352H8jfKJ19hVPy1/ZoKljCz0DrKHLLPJzHQ1lPEAK7P3lUzvIg== X-Received: by 2002:a05:6000:546:b0:2be:3501:3645 with SMTP id b6-20020a056000054600b002be35013645mr12159419wrf.38.1674367967942; Sat, 21 Jan 2023 22:12:47 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id ba29-20020a0560001c1d00b002b065272da2sm18775126wrb.13.2023.01.21.22.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 22:12:47 -0800 (PST) Message-Id: <74a216bf0c02d4cb3e91b0de9e5fcd617f611672.1674367961.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 22 Jan 2023 06:12:38 +0000 Subject: [PATCH v4 7/9] 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 1ba691e4c5f..9f794f5bdcc 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 Sun Jan 22 06:12:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13111409 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 5349BC54EED for ; Sun, 22 Jan 2023 06:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229811AbjAVGNC (ORCPT ); Sun, 22 Jan 2023 01:13:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjAVGMw (ORCPT ); Sun, 22 Jan 2023 01:12:52 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463C018A93 for ; Sat, 21 Jan 2023 22:12:50 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id e19-20020a05600c439300b003db1cac0c1fso6990533wmn.5 for ; Sat, 21 Jan 2023 22:12:50 -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=bQT8ZRnPmMCCn/HjLUYgksMaDlS8hm85UOkuFMXUm2Q=; b=fNfYG78HuHt3hWZ7cnXnTKbOHmphFHZsClbk2NNFbYzbUfBkwUBogW/NQ9p/dqdwxW c68zvfErAYf4+gAiwnd/sMLJ8k/ef5mbGzgAJNaCkSsGnoACFY/BpKYP8mbrIG5LAlwu pk5OyXx5tzubCfE0YWK9RO8+jAECLUoI+ut2zh57KgsWiAEmh/JIUgElBDJjpxpR+k05 +FhpoIur7YX8ue9z7n9jaKclntNbYwMNs6JorCtBehFG8SlzMJ51pyeg/tV6PL3xVhvT 5EvAsM5UO4Ms0me5Ba749f34WvBB5NSbuHE43J9p6Sqk7UdJ+/k+FoDvsl27XBQqsQK+ 92Uw== 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=bQT8ZRnPmMCCn/HjLUYgksMaDlS8hm85UOkuFMXUm2Q=; b=nyqAnWX9KXnISl5w/j6xViKjxKLvKZ4fqyYUxhGPlmdTWIkxK7WGjBd3IZHPs8vZdb tlqRYKwp/KLcGbcZPCH2RQ3C0xvtSiUGglf+R/N99RpuInea0Ce7PRmhJoot2loGJwuJ y8B+yUBqqElp/zBhB2Zo4SlwTFaroGnG6OEk9QILumNSTmzXtXunocyVYlwPCwsabvZW 7tL/8XwQEtQPgXmOraZmP8bDn93gMGREPNfnn6Pv/STWtctnbKPZxf0ATMJpsfDLR3Mx eCVM0j25q/PYg7uTrKBMGgmkpfSmfCDF208loxzQuzvYLnjCxKsjhjCHTxLGwg0jM1A2 QBbA== X-Gm-Message-State: AFqh2kq6hBbhU1PY+hCrKhWzxXVzv/Kxi4DCaZ+OmKRv/1mqmlmuiRiE q6gcrrsq7YkkZ3h50WNV6WiZPo8aII0= X-Google-Smtp-Source: AMrXdXsCcyHBpZ4vkh2bnRKVuSR2DRv0P7vOZPY9MqN56NZHuzS8QbR7wTeCX+88haDO0Sq16zOeVA== X-Received: by 2002:a05:600c:539a:b0:3d9:ef72:190d with SMTP id hg26-20020a05600c539a00b003d9ef72190dmr19189251wmb.19.1674367968652; Sat, 21 Jan 2023 22:12:48 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l18-20020a1c7912000000b003db00747fdesm7008727wme.15.2023.01.21.22.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 22:12:48 -0800 (PST) Message-Id: In-Reply-To: References: Date: Sun, 22 Jan 2023 06:12:39 +0000 Subject: [PATCH v4 8/9] 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 ed7475804cb..2358605b254 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 Sun Jan 22 06:12:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 13111411 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 6E9ABC61D9D for ; Sun, 22 Jan 2023 06:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbjAVGNB (ORCPT ); Sun, 22 Jan 2023 01:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbjAVGMw (ORCPT ); Sun, 22 Jan 2023 01:12:52 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F004C18A94 for ; Sat, 21 Jan 2023 22:12:50 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id l41-20020a05600c1d2900b003daf986faaeso6381314wms.3 for ; Sat, 21 Jan 2023 22:12:50 -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=ZKvywFic2idymqZrC+B70vV/Ye3CoIxnWj1qKI+swdE=; b=aTZlO/l1i/xqh1EfYjoAkS8DTK53Jv+ngTz3jNZ4LchoAUXt3bLD2FLJ3XbgRDIBye Ra1pCWpJ0B36M77WvmZBfwHxuazf2KQ3l3P1TPeQxvwXICuUN00rGfBSSsbIVID8deEz fO7ITwYFIIkqQzzm0A1miJv6hIVpDCQZAEd2vvVXazfvWsmvG+P3kLaxg4RThLdYQA+6 1G80teHNXU5TEvfhvvL4Fqn5IQ6FGQpBtcQfVBNojdz5wqxHtZOi2zVEAyPl06qkFxBv FAaSfjM3fTVPkJ+vaCZz0EApELBMWpvKtPd5nD9JuAJGjRFu6YS2OFt7bsfP7UHWkYWm pvLg== 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=ZKvywFic2idymqZrC+B70vV/Ye3CoIxnWj1qKI+swdE=; b=3yQdGATnO72mLprNzJhiX4PLFfNfs67/Zt1YWtym644w9cA8ELmAGWWwj0eNVljnQS 7eiAT48LLScfYh33/SwQWEptY79k49AYZV3mItfOaxdrYTxVHfcF0jp8axdsRrwLzvo1 S4YueTEdCtPT/kH0H5RgobryRcP7Ff+cL27SNYqK3bQkaMGpMmsiQj/SiRzD5HSp7mA2 7rZL3cJNZ/dBwHDX26WqA9T4itDbGYamj6cJOVIlmoYN5HASH726TT3Yv+BgOrSLed4B hZOpjR3+Zeig7bBLkcT9RHx/03pniPjAGay/+xciMDT+PCzWAEyyvX565mKQOqcqTLim o5Zg== X-Gm-Message-State: AFqh2koK0rh88IA7Qsy3W8N3ZPTr1h/nscVqvrbywCHJ2Bhp39A5JGjs /50BbcfhSzZy4Q1JmUNPS7k83oGRoog= X-Google-Smtp-Source: AMrXdXs0+uEJgIWFTNF87SrGGKt1ItsauJ0MPPw3c8LrVrcDh28wtOoulEL1+FK+myvMXBIJHtJU6w== X-Received: by 2002:a05:600c:348f:b0:3db:742:cfe9 with SMTP id a15-20020a05600c348f00b003db0742cfe9mr19616921wmq.34.1674367969276; Sat, 21 Jan 2023 22:12:49 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id o18-20020adf8b92000000b002365730eae8sm1750581wra.55.2023.01.21.22.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 22:12:49 -0800 (PST) Message-Id: <5cb00e5103bd701a90ea3f5b3532fa184b6e6ae9.1674367961.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 22 Jan 2023 06:12:40 +0000 Subject: [PATCH v4 9/9] 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 9f794f5bdcc..c357f6c3d5c 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 2358605b254..dd7e2c788f5 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; } @@ -1393,7 +1399,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) @@ -1504,20 +1511,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