From patchwork Wed Jun 30 16:38:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12352587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EAACC11F68 for ; Wed, 30 Jun 2021 16:38:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B54361446 for ; Wed, 30 Jun 2021 16:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232135AbhF3Qkr (ORCPT ); Wed, 30 Jun 2021 12:40:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhF3Qkq (ORCPT ); Wed, 30 Jun 2021 12:40:46 -0400 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 477D3C0617A8 for ; Wed, 30 Jun 2021 09:38:16 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id u6so4427259wrs.5 for ; Wed, 30 Jun 2021 09:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pF/2z1EMeqcKWl1pcQ275R9HcTceKENoTxCAZiH/IO8=; b=C6AE3FNR72MpnOCaY8rtEnvXvTc+2WKIYUYvXS5NpWVMEKjP5z0HTOhMhaLPTAyYjp Pdq+4s27egteO1zDHfZ2sQBPb7MnqkGrBoSk/w0xI5vqVGT46BoJfz46K6+nfuSNcr3W EIWUI7nMyWFvbFwxcepD2vuqwqz16uAFzKU/PmA9dV9itZztx7Dlf7qO1E66GwJfkBcX RVw7J/OMLJ+vT9FgDCiJgzy3eM+b8BeRNvPJyIEe2cO3Y3WfKXQhfo6AgUPkklmTDGoc fdb03oDfKg0yOZPO6R4mdgaWXAs7idBdV/ALovPHOL6V/u1mjGe0o+lMD0r7mJ/q2J8y XoUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pF/2z1EMeqcKWl1pcQ275R9HcTceKENoTxCAZiH/IO8=; b=O1tNjvF7hgF0GGUA7Ye7ErorzJqwYN/mT3cjrxGbbUJP/H3jVpDunWf68fvMCinhpO s2dZ9EgIUSC6SclBuYzyJm07dekh0h9KVjNQsOQHWXjx5juUlg8zJHZoDsFOSm2mfDrn gRqBzvMXX11QxwvWD5ZqNu7tkUF6aYORWL4qePrF6gip5nGOilqJ/DPWbe3fzi3i7G3v Hcm6j/Z7czSJjFFA+EGMYxP6c4VMTxHfkFk3jJ7JNBeKp3mD2i34bYNv9hA9jbEBjZnW AjEnpSLJHzTpYfN6wfrw1krLh02UDsz9SfrP8QbGZ2INM+pP4/ZiH4S5UNJgy40yZS1Q D9ow== X-Gm-Message-State: AOAM532JshD0rpohg5yGqQPcuDqolDoc6X3czAz4qOLGIEZuUNlkfxUF LIkaw+ciBPFrc8kOeClissa4SWUd0eKF+g== X-Google-Smtp-Source: ABdhPJySFg+bd14NW7zCN7XDdCGk6puSzWO3oaR9m4H2972h6TvaszDpnzRZuhd6FET1DeDnfm31uQ== X-Received: by 2002:adf:d0ca:: with SMTP id z10mr38871550wrh.376.1625071094699; Wed, 30 Jun 2021 09:38:14 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id l1sm1952066wme.11.2021.06.30.09.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 09:38:14 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jonathan Tan , Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 1/3] send-pack.c: move "no refs in common" abort earlier Date: Wed, 30 Jun 2021 18:38:10 +0200 Message-Id: X-Mailer: git-send-email 2.32.0.619.g53a98c35da0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Move the early return if we have no remote refs in send_pack() earlier. When this was added in 4c353e890c0 (Warn when send-pack does nothing, 2005-12-04) one of the first things we'd do was to abort, but as of cfee10a773b (send-pack/receive-pack: allow errors to be reported back to pusher., 2005-12-25) we've added numerous server_supports() conditions that are acted on later in the function, that won't be used if we don't have remote refs. Then as of 477673d6f39 (send-pack: support push negotiation, 2021-05-04) we started doing even more work on the assumption that we had some remote refs to feed to --negotiation-tip=* options. We only hit this condition if we have nothing to push, so we don't need to consider "push.negotiate" etc. only to do nothing with that information. Signed-off-by: Ævar Arnfjörð Bjarmason --- send-pack.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/send-pack.c b/send-pack.c index 9cb9f716509..5a79e0e7110 100644 --- a/send-pack.c +++ b/send-pack.c @@ -486,6 +486,12 @@ int send_pack(struct send_pack_args *args, const char *push_cert_nonce = NULL; struct packet_reader reader; + if (!remote_refs) { + fprintf(stderr, "No refs in common and none specified; doing nothing.\n" + "Perhaps you should specify a branch.\n"); + return 0; + } + git_config_get_bool("push.negotiate", &push_negotiate); if (push_negotiate) get_commons_through_negotiation(args->url, remote_refs, &commons); @@ -534,11 +540,6 @@ int send_pack(struct send_pack_args *args, } } - if (!remote_refs) { - fprintf(stderr, "No refs in common and none specified; doing nothing.\n" - "Perhaps you should specify a branch.\n"); - return 0; - } if (args->atomic && !atomic_supported) die(_("the receiving end does not support --atomic push")); From patchwork Wed Jun 30 16:38:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12352591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 587FDC11F65 for ; Wed, 30 Jun 2021 16:38:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B23761463 for ; Wed, 30 Jun 2021 16:38:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232254AbhF3Qku (ORCPT ); Wed, 30 Jun 2021 12:40:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhF3Qku (ORCPT ); Wed, 30 Jun 2021 12:40:50 -0400 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 0DB20C0617AD for ; Wed, 30 Jun 2021 09:38:17 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id g7so4417077wri.7 for ; Wed, 30 Jun 2021 09:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xq2GjWaszMHVbSGR9tG99l7+0zfiMGE2iZdnipHKtUY=; b=WC7oScXK/7Vy8f2q2jkfIlFPHcU75ElwzTajtU4N0M0J9DnhS/CTytlaShRmPq+C7Z sIypkdTga/quPe38pRQcg74GGwn9cvGGMPiJ+hfMMKSiMk/a8jejVPDcI8Z/3cmlINam wfiY7m+J8/hoVF0YX2iSF8LmNOId1/yWY714ms5YKSYTwnT10Ixh+phsQ9JgdE9Svvw8 DVVLicKRbL3YsmW8MnqvE2yXazeT7lXe/S9XJ/cCOPy78vWWjzE/IhIaOftIhlWvY8Ct RBz8YSkm8SzHRY/gneXFg2J2w7XagQwP4HBcrX+Z5u74rLvTcMN6h8MGa9wYDK6cA9PM rRSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xq2GjWaszMHVbSGR9tG99l7+0zfiMGE2iZdnipHKtUY=; b=XSZRI4bKcTihrOR4C5Hx+MNbROx2m3GGqdqNZlyehGJBBoOR5VPo9UAm4axA8gZOKV mc/8RsvIDc53ZWIbkPhjYjhfKeEeex1nftjmQjIoyVNzn+hDAiSWQslALQCGBYNEoFY1 qwjcAqgJQwSobvjI6P0x9Ml60rgucxRZtecZu5bvl3KCk8I6bQiwEqfdFvG8owBy7bQ0 DxMxmMzHjcRkf0HcceF/3ejmK5vWF2WkDKbieOm60cUYRMkV+WcaqT2/Sg3euRQGZDNL MvSPwg66MR5V4rtYaSFdcaDyCSEHB17Mp/oVTUXdPctdJ0suOhiaLDlsZ4G7SbRJnbXk XNVA== X-Gm-Message-State: AOAM532XdWmtdjE7rRc08YibtD9M7xj44bWoHXG8kKjQ1x+ocp4NOlwy b5xijODKYHCWY0b2kAraOfnhl+y7BfkP/g== X-Google-Smtp-Source: ABdhPJx8Z9/HSNUqdnZ1zKTREwVNEitLLSOnJGo5V7GaTOUaMcRwNGSWYWdkKwH2VPl9nRv/TRc28A== X-Received: by 2002:adf:ec8b:: with SMTP id z11mr15396455wrn.408.1625071095400; Wed, 30 Jun 2021 09:38:15 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id l1sm1952066wme.11.2021.06.30.09.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 09:38:14 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jonathan Tan , Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 2/3] fetch: document the --negotiate-only option Date: Wed, 30 Jun 2021 18:38:11 +0200 Message-Id: X-Mailer: git-send-email 2.32.0.619.g53a98c35da0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There was no documentation for the --negotiate-only option added in 9c1e657a8fd (fetch: teach independent negotiation (no packfile), 2021-05-04), only documentation for the related push.negotiation option added in the following commit in 477673d6f39 (send-pack: support push negotiation, 2021-05-04). Let's document it, and update the cross-linking I'd added between --negotiation-tip=* and 'fetch.negotiationAlgorithm' in 526608284a7 (fetch doc: cross-link two new negotiation options, 2018-08-01). I think it would be better to say "in common with the remote" here than "...the server", but the documentation for --negotiation-tip=* above this talks about "the server", so let's continue doing that in this related option. See 3390e42adb3 (fetch-pack: support negotiation tip whitelist, 2018-07-02) for that documentation. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/config/fetch.txt | 3 ++- Documentation/fetch-options.txt | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Documentation/config/fetch.txt b/Documentation/config/fetch.txt index 6af6f5edb27..63748c02b72 100644 --- a/Documentation/config/fetch.txt +++ b/Documentation/config/fetch.txt @@ -69,7 +69,8 @@ fetch.negotiationAlgorithm:: setting defaults to "skipping". Unknown values will cause 'git fetch' to error out. + -See also the `--negotiation-tip` option for linkgit:git-fetch[1]. +See also the `--negotiate-only` and `--negotiation-tip` options to +linkgit:git-fetch[1]. fetch.showForcedUpdates:: Set to false to enable `--no-show-forced-updates` in diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt index 9e7b4e189ce..e967ff1874c 100644 --- a/Documentation/fetch-options.txt +++ b/Documentation/fetch-options.txt @@ -62,8 +62,17 @@ The argument to this option may be a glob on ref names, a ref, or the (possibly abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying this option multiple times, one for each matching ref name. + -See also the `fetch.negotiationAlgorithm` configuration variable -documented in linkgit:git-config[1]. +See also the `fetch.negotiationAlgorithm` and `push.negotiate` +configuration variables documented in linkgit:git-config[1], and the +`--negotiate-only` option below. + +--negotiate-only:: + Do not fetch anything from the server, and instead print the + ancestors of the provided `--negotiation-tip=*` arguments, + which we have in common with the server. ++ +Internally this is used to implement the `push.negotiate` option, see +linkgit:git-config[1]. --dry-run:: Show what would be done, without making any changes. From patchwork Wed Jun 30 16:38:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12352589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E142FC11F65 for ; Wed, 30 Jun 2021 16:38:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C353F61477 for ; Wed, 30 Jun 2021 16:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232220AbhF3Qks (ORCPT ); Wed, 30 Jun 2021 12:40:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232154AbhF3Qkr (ORCPT ); Wed, 30 Jun 2021 12:40:47 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0AFBC061756 for ; Wed, 30 Jun 2021 09:38:17 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id i94so4446937wri.4 for ; Wed, 30 Jun 2021 09:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=36pGSabGB3NCxxaUzLA2Vmg6bamBwzIR2/j1fpjexv0=; b=g8LEIxuaJo0U7y3Eu/qhpgMkLzVFi3Xk26UbEzVxMs9byWb8HWzD4kvyXeRrYCe5zO MaDshWn57r83iWWN8u4pu9Mm6T+Xe3OxmlEG3w+V3QFvk75DGvlnmPps9RKzTOchbZYB 26A/09i0+5UMzGjUAqBhvOkXgyiDH+/tAZboO5r9YS0zSGytLOfTKDnUl94rdbFfZauL KLcE06H1poJO2asYk830kqPKCJlwpG3GCM8UcFZS+QHwDOexT1wG/qYTTflHsyOPiJwT 9GOUdJc3jt6jglq+aY6qRx4sc8bbgF/IaqB24G79ons+YGNRV0jbeSQyzxdp5DAV3f/k U6yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=36pGSabGB3NCxxaUzLA2Vmg6bamBwzIR2/j1fpjexv0=; b=rrBO9aMYCmW64APtA4pRsv3MpR2gTb8RPsQlQ7iYBtYWvuzqbLr+Hay92FIUeqXOlS bXORtuZDjWglj4YIBr0Q6itRYdXXAEjNBIkgO7Tz0KalIU8JioXPopuw9tdhn/aeozib 08RBPITXo/g8PFtuaYkENUr3MeBHvFEBdEI7X22pVkK2afqd0H/qIwN6SIvKDTHtwFGE FMbfRStWcElnFPlWZjLsC9gMwWobb7FgCWBsFSdDb1idbqMiv9IDE5CaMYk8Y1yv57o+ UcIqrsP/+1orHjngqJ1dn7pdrkyCWDs25rIwsksaUg6DBU7wQDUOH7U+F2YaYeEpO4WI zdzg== X-Gm-Message-State: AOAM5311SlXm4FrrbV3yuN3NF14APYaD84hk9Oivud3JR/PhxLMWq3tt o+OKD6WNepN8MlV4JcU7ONDHKM93i/Z6xw== X-Google-Smtp-Source: ABdhPJzPQsVVhCBVgD2lyZMaC885H/ZYNgkc364xnfN6ribiJVT5MK5viXC8Si9t5fp1PCpYB1WcGg== X-Received: by 2002:adf:9bd0:: with SMTP id e16mr40627882wrc.392.1625071096219; Wed, 30 Jun 2021 09:38:16 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id l1sm1952066wme.11.2021.06.30.09.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 09:38:15 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jonathan Tan , Derrick Stolee , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 3/3] fetch: fix segfault in --negotiate-only without --negotiation-tip=* Date: Wed, 30 Jun 2021 18:38:12 +0200 Message-Id: X-Mailer: git-send-email 2.32.0.619.g53a98c35da0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The recent --negotiate-only option would segfault in the call to oid_array_for_each() in negotiate_using_fetch() unless one or more --negotiation-tip=* options were provided. All of the other tests for the feature combine both, but nothing was checking this assumption, let's do that and add a test for it. Fixes a bug in 9c1e657a8fd (fetch: teach independent negotiation (no packfile), 2021-05-04). Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/fetch.c | 3 +++ t/t5702-protocol-v2.sh | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/builtin/fetch.c b/builtin/fetch.c index 9191620e50c..25740c13df1 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1990,6 +1990,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) fetch_config_from_gitmodules(sfjc, rs); } + if (negotiate_only && !negotiation_tip.nr) + die(_("--negotiate-only needs one or more --negotiate-tip=*")); + if (deepen_relative) { if (deepen_relative < 0) die(_("Negative depth in --deepen is not supported")); diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index 66af411057c..920815478c7 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -599,6 +599,23 @@ setup_negotiate_only () { test_commit -C client three } +test_expect_success 'usage: --negotiate-only without --negotiation-tip' ' + SERVER="server" && + URI="file://$(pwd)/server" && + + setup_negotiate_only "$SERVER" "$URI" && + + cat >err.expect <<-\EOF && + fatal: --negotiate-only needs one or more --negotiate-tip=* + EOF + + test_must_fail git -c protocol.version=2 -C client fetch \ + --negotiate-only \ + origin 2>err.actual && + cat err && + test_cmp err.expect err.actual +' + test_expect_success 'file:// --negotiate-only' ' SERVER="server" && URI="file://$(pwd)/server" &&