From patchwork Tue Jun 21 22:34:13 2022 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: 12889874 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 69051C43334 for ; Tue, 21 Jun 2022 22:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354459AbiFUWed (ORCPT ); Tue, 21 Jun 2022 18:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232637AbiFUWe2 (ORCPT ); Tue, 21 Jun 2022 18:34:28 -0400 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 DA89C264E for ; Tue, 21 Jun 2022 15:34:27 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id j24so139277wrb.11 for ; Tue, 21 Jun 2022 15:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7DF1sdrpNAYnXZRFsn/4tHewBRbmrzl9gBUCFXHx7gU=; b=G+KC9g2cQ7SC4GsnpB8oeHYHbX4ZIR04tuRSpDeUgEGuF4mA9xAyUr4IEoOjaIdlto oreJMaw1USNqG6mM4Zmu0E+pv7LJbgeuMjJKUEswe5iCwIkoUndjNcD84rIplMh6VNMw jwfHF9ZlYbSxV31k8MVZeoc5Hi/35izatqHGXNpm8jrBaD2cOHDP5IhAAE18YhxKglKE OTTMgaiPUxMnJrWw139Jg83izrgCpAOcvQeIfFSwyo9uwRUNmsL1XMZjMKmqNDqPXzQa EOGIdMrA8mppNr+3DMDwZWBNDtqInG+9xRZfwlwhtH1BI/X0fjOc8Rjqnnm4P2t9dZUq XT0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7DF1sdrpNAYnXZRFsn/4tHewBRbmrzl9gBUCFXHx7gU=; b=qqMVXzmq5vgkVEqibknRW6TZeGa88CKWbbeSrVykhj2g35bxDvnS4m0LoT/3IPkkUq 9aiG6qCRKugplwG4ApsxpF3Kr3w7/kAMEwN0IjqDCu1me7psISmhzhvb9XDH/HbmDIQz 3313ewCkwENcYR05aAQCs5Y275IRC42Oksh7OD0HFLpIvaB1qiSlVmhm4G+RNb4fyukD KQv7re21Sz5puMHo2kVYaysMUEcqYYvqAzjxgqLZ9rAokQk/CAoRP5vV7u/5N0JgHcIL wzwx79cRx2hna7BFGavd5Qh8V5pKGNzUdurRoeuQ9GtWRSqbjGa73Ij6yOc1OWj/isGr y2uA== X-Gm-Message-State: AJIora+97/ZK+3aOnHPr2eLhQqFzsDDI5Ctu0a4r9HAhiHSpVasap51x JMVLqBSMzXaVKqk+2Uwm7oMxFAU4STHmig== X-Google-Smtp-Source: AGRyM1tYQmTp/Dr9bnFdK/oGXWBU/Qst7FT2AdFYrizy9+NPBsqMT32sJXmc8Sr/pBltl7plOImbbg== X-Received: by 2002:a05:6000:69c:b0:21b:9280:9b2d with SMTP id bo28-20020a056000069c00b0021b92809b2dmr201818wrb.203.1655850866085; Tue, 21 Jun 2022 15:34:26 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:25 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 01/10] fetch tests: remove redundant test_unconfig() Date: Wed, 22 Jun 2022 00:34:13 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_unconfig() calls here were added as boilerplate in 737c5a9cde7 (fetch: make --prune configurable, 2013-07-13), and then faithfully reproduced in e249ce0ccdb (fetch tests: add scaffolding for the new fetch.pruneTags, 2018-02-09). But they were never necessary, so let's remove them. This actually improves our test coverage, as we'll now be asserting that whatever configuration we leave here (in the "one" block below) won't affect this particular "git fetch" command. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 4620f0ca7fa..d784a761ba0 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -874,10 +874,6 @@ test_configured_prune_type () { git tag -f newtag && ( cd one && - test_unconfig fetch.prune && - test_unconfig fetch.pruneTags && - test_unconfig remote.origin.prune && - test_unconfig remote.origin.pruneTags && git fetch '"$cmdline_setup"' && git rev-parse --verify refs/remotes/origin/newbranch && git rev-parse --verify refs/tags/newtag From patchwork Tue Jun 21 22:34:14 2022 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: 12889877 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 B6075C433EF for ; Tue, 21 Jun 2022 22:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354518AbiFUWej (ORCPT ); Tue, 21 Jun 2022 18:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354458AbiFUWea (ORCPT ); Tue, 21 Jun 2022 18:34:30 -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 0266264E7 for ; Tue, 21 Jun 2022 15:34:29 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id j24so139334wrb.11 for ; Tue, 21 Jun 2022 15:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9//ZlFMmjfMIyIvC7PJURM/esIx9UV2n4rjrfxybLXs=; b=VIcvx0vgCAH/NOCWdmB/fM18UEiA4DhMSq4eBCnOkAOSLjt1IM0kLulPXXu8MclAWK 3MsJoPsvRiimnUMzI+Yp2Meb+fK7eaWhTRS66L7/GLlpqp40WUtvorOpvecLE3lYs/qy SaNhIT/gcv+cIot99Y69mF0h6cHlDEjiUOFczCt/ntDtSN3oczZtQj28/UueWuxLyrSD MlzkLw7Imv/fwJXf2k27yE1JJGMDGnA+6h2FMp29t+S9RJ09CDeYF2u3st/tICAEK5Xz E0l/4GvGuaaU1Z+L5V1jd6ZZER1Qiz4mI/n3CcQ85sGD9Qxhmvkiwuc85A49d31Gk1EW EXag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9//ZlFMmjfMIyIvC7PJURM/esIx9UV2n4rjrfxybLXs=; b=Tn/TkZWUiIpVVQWdSYPZtzEvHLB7XHKoCVmUO9N16qKNeoSda7rvTZZbntcPrcU6H4 TiNAYkageJeHzzzq0lobWLTFASeaYCGjgKZcOkbFiAK+T8oH34uNSbjaI8d4xt6jS3+5 PZ+vd+GbATIXNDL7TPXKpfFUaxrNgCNRRCn/9byQZ5biP1qHE0bBEK4Pzp0OyzB1/UQS iqsn7pswi8YUoFkZkmQ9IrVQ8jnD8aKfBiMCyp19s/Z7ioU/HlERxscBBSM6FejsmSRM loEf8n6ysWrIRlXil42lHD+W1NSt7L79bVo6izn4BPQs4WbN+YwyD2jFhV55LWtNc+1f DnjA== X-Gm-Message-State: AJIora+dpYNLmCLPzq2WJ0863wRDqtTGPUOrL6rT4F2pf9EFCQ9HkBtE Vp00ogPfZOSkE/wssIXhMYFUz7uILokyLw== X-Google-Smtp-Source: AGRyM1uUeapbazbKU6bEWqDoRbUEq2BH2Xo726W/9tVKl7iWivCQPEZ8CZ1g2Nn++WI/TmwVBeAMbw== X-Received: by 2002:a5d:49cf:0:b0:21b:818a:a09b with SMTP id t15-20020a5d49cf000000b0021b818aa09bmr212917wrs.676.1655850867192; Tue, 21 Jun 2022 15:34:27 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:26 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 02/10] fetch tests: use named, not positional parameters Date: Wed, 22 Jun 2022 00:34:14 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Use the named parameters we've already unpacked from "$@" rather than the positional paremeters. There's no functional changes here. This changes code that dates back to the initial introduction of the function in 737c5a9cde7 (fetch: make --prune configurable, 2013-07-13), although e.g. e249ce0ccdb (fetch tests: add scaffolding for the new fetch.pruneTags, 2018-02-09) added many more parameters. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index d784a761ba0..37e12de2475 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -868,7 +868,7 @@ test_configured_prune_type () { cmdline="$new_cmdline" fi - test_expect_success "$mode prune fetch.prune=$1 remote.origin.prune=$2 fetch.pruneTags=$3 remote.origin.pruneTags=$4${7:+ $7}; branch:$5 tag:$6" ' + test_expect_success "$mode prune fetch.prune=$fetch_prune remote.origin.prune=$remote_origin_prune fetch.pruneTags=$fetch_prune_tags remote.origin.pruneTags=$remote_origin_prune_tags${cmdline:+ $cmdline}; branch:$expected_branch tag:$expected_tag" ' # make sure a newbranch is there in . and also in one git branch -f newbranch && git tag -f newtag && From patchwork Tue Jun 21 22:34:15 2022 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: 12889876 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 1C336C43334 for ; Tue, 21 Jun 2022 22:34:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354509AbiFUWeh (ORCPT ); Tue, 21 Jun 2022 18:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354478AbiFUWea (ORCPT ); Tue, 21 Jun 2022 18:34:30 -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 02AC3D133 for ; Tue, 21 Jun 2022 15:34:30 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id o16so20853902wra.4 for ; Tue, 21 Jun 2022 15:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9SKREIOOggaRjJlBPAwycKlciSlmhOQX6RJERnKt+JY=; b=bXcqo3wW8FO7zpYJpCaZu1h8AcK8iMtkY81foz67Bf0K4CwKKVXz2/05kiGs4ggxtf mAGweLyazzjb1OGxnos2qts71oViGTsaUPgZRSKw98x8wpbZIPrrmgX5/+LV6dgfr6Lv ekc6Z01hlQdtcbQBFCBNCFpQeXsBjslDrQYvHjXs96AvRK4GyM3kt3uLZ2KxPpVle5A1 HbF00m84ynb0UCz7OIPZ7PaIAoc3vpYHyZJQTw2OIWmzaP3w+mn7mcNaifRVV10wDwmg oKtTB9pzcef5L8J7KZNYISJyswHn5u+2M4PwKJ91SQchFa6oj5NzNTqB0h4GUU/haXYf G6Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9SKREIOOggaRjJlBPAwycKlciSlmhOQX6RJERnKt+JY=; b=sRAGfcCOY7ZJUWgKNEphC7tfkaKiivEO3pLPAZJvqu9yBi1SDkG0YmlrOQWt06Dgce rQBnGBwdeN7SQYjc5GwENT+S8QZF4vD07NB05uJrwhJQNTjjadw+2pT8dpCckqKJL3RH KzcT1ct2BAxurLzK5Cchg7ArHDOeIXdGyUDPsv0V6wns3iW/3exJV51UGd1P7d26s9k2 9AZvJPbgYBMewUs6HQuefp6w4+NKUJlK8P5K7qLwdreHR/HeSjdjKJiobuHFSKSDQzTA SP6sn04YWCB7sUxS3vozA4cGxcQZfzPbYR+ScVXPHvFfSkgcs2mX1lufcSq2pLigyfCS WdUA== X-Gm-Message-State: AJIora/f87yfNLOIx7a3JLJrly+svSg2KRdBpvO0/PZ05FyesubvRWwS XExBex5VwnIHSB63I2z2w0dmO3f0hil5Uw== X-Google-Smtp-Source: AGRyM1tni6RKwpv27V08Ckim5ZbImh9ctwLvAnlXqApBf6yEYVWyY5GGpxhYfGhjWc1GbdqQh8g5aA== X-Received: by 2002:a5d:570e:0:b0:21b:8aec:3e69 with SMTP id a14-20020a5d570e000000b0021b8aec3e69mr205154wrv.177.1655850868233; Tue, 21 Jun 2022 15:34:28 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:27 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 03/10] fetch tests: use "local", &&-chaining, style etc. Date: Wed, 22 Jun 2022 00:34:15 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Make use of &&-chaining, the "local" keyword, the more idiomatic "test -z" over comparison against "" etc. in the "test_configured_prune_type()" function. Let's also move the wrapper function to below the function itself. In e1790f9245f (fetch tests: fetch as well as fetch [], 2018-02-09) placed in there to minimize the diff size. While it's not incorrect to define these in this order (this isn't C), it's less confusing this way. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 37e12de2475..799e69dc1b1 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -821,20 +821,15 @@ set_config_tristate () { esac } -test_configured_prune () { - test_configured_prune_type "$@" "name" - test_configured_prune_type "$@" "link" -} - test_configured_prune_type () { - fetch_prune=$1 - remote_origin_prune=$2 - fetch_prune_tags=$3 - remote_origin_prune_tags=$4 - expected_branch=$5 - expected_tag=$6 - cmdline=$7 - mode=$8 + local fetch_prune="$1" && + local remote_origin_prune="$2" && + local fetch_prune_tags="$3" && + local remote_origin_prune_tags="$4" && + local expected_branch="$5" && + local expected_tag="$6" && + local cmdline="$7" && + local mode="$8" && if test -z "$cmdline_setup" then @@ -843,18 +838,18 @@ test_configured_prune_type () { remote_fetch="$(git -C one config remote.origin.fetch)" && cmdline_setup="\"$remote_url\" \"$remote_fetch\"" ' - fi + fi && if test "$mode" = 'link' then - new_cmdline="" + new_cmdline="" && - if test "$cmdline" = "" + if test -z "$cmdline" then new_cmdline=$cmdline_setup else new_cmdline=$(printf "%s" "$cmdline" | perl -pe 's[origin(?!/)]["'"$remote_url"'"]g') - fi + fi && if test "$fetch_prune_tags" = 'true' || test "$remote_origin_prune_tags" = 'true' @@ -863,10 +858,10 @@ test_configured_prune_type () { then new_cmdline="$new_cmdline refs/tags/*:refs/tags/*" fi - fi + fi && cmdline="$new_cmdline" - fi + fi && test_expect_success "$mode prune fetch.prune=$fetch_prune remote.origin.prune=$remote_origin_prune fetch.pruneTags=$fetch_prune_tags remote.origin.pruneTags=$remote_origin_prune_tags${cmdline:+ $cmdline}; branch:$expected_branch tag:$expected_tag" ' # make sure a newbranch is there in . and also in one @@ -915,6 +910,13 @@ test_configured_prune_type () { esac ) ' + + return 0 +} + +test_configured_prune () { + test_configured_prune_type "$@" "name" && + test_configured_prune_type "$@" "link" } # $1 config: fetch.prune From patchwork Tue Jun 21 22:34:16 2022 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: 12889875 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 8F62BC433EF for ; Tue, 21 Jun 2022 22:34:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354507AbiFUWeg (ORCPT ); Tue, 21 Jun 2022 18:34:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354481AbiFUWeb (ORCPT ); Tue, 21 Jun 2022 18:34:31 -0400 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 058DC264E for ; Tue, 21 Jun 2022 15:34:31 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id i10so17092238wrc.0 for ; Tue, 21 Jun 2022 15:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WFUMVQSQKlu7nIYrPu5XWfVVrVG2zFi4qm1voYVbvHM=; b=UFW0suzc+AozRpw8P2jFM2uZ6xh3urCgbFu2vqZWyX+j8Dy4s6vKruyYKMhAuR+AKU ngOL5ckdHeMBnCF1gBlb+CG37juafLct0olHL5VlgoGhw8LMs3jZlHKz+2exFugqsp3O AYHHpBQ7HXm2FfZtFAIQTFeNsFXeOASbsDom0w9hLizVLLf+9ccx3XrXTB+gKvW1jyuD 9O7yPZePcqprPb7cIa67RTp86uz9K/d880jB5xdpg/5u/+u5LrKK1I40Jg2hoRd2Wjlg FWjqHl1Ra8GHkogrW0782FUvjFvhkrbRTLxTWLlMnh2iFVz9EgUR+UMT109Nnkt1fmsI Avpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WFUMVQSQKlu7nIYrPu5XWfVVrVG2zFi4qm1voYVbvHM=; b=sMzHUNlVpaTw7Aa0xwyy66PRXA8dStyrxWcbJfc83u5IRmD9Ce88gxacCuvcGwWXqN S6OA+Y8rGwSn3wwZ6q8echV/3L4A/fF6c+xCs4h+a253/JMxFsxfQxH3AAd3paDJNEO1 HiOD61VAMqirqO8EwUdub8+pzBiuS5SV4/F0yz++SfFzHhzaO/ofhdBfl9EgEk4ntfg9 LTYLCYS9c83bDLdRtcu2wgPp6+f1YB0onBzpK2bi36YxbdEoR3tx6wuV3HICfgfiNG+8 0/IhBJCk45ty49vxiQqdhdZscy8KA7Y4xNfM4Nvo2vYU6mErlWz+KW3TYIO8HhXkuvWV kriw== X-Gm-Message-State: AJIora95hES6XXdOXy/7CTmZ9O/jl7e29KgXlyd5gEgvLTRia7hDX+y+ WAbE9iDk8OaXuUrEid9+FPIFtQtOypBvqA== X-Google-Smtp-Source: AGRyM1vWM3FN9Y3y8BRDAAp4MSv17g9W9WzjrDPulSuWnRNXuLj5okOLiOGu5mIKdC6I3oLB3hOVsA== X-Received: by 2002:a5d:4205:0:b0:21b:89ea:b5e3 with SMTP id n5-20020a5d4205000000b0021b89eab5e3mr204232wrq.103.1655850869231; Tue, 21 Jun 2022 15:34:29 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:28 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 04/10] fetch tests: add a helper to avoid boilerplate Date: Wed, 22 Jun 2022 00:34:16 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add a new test_configured_prune_type_branch() helper to avoid the boilerplate introduced in 97716d217c1 (fetch: add a --prune-tags option and fetch.pruneTags config, 2018-02-09). Back then it was somewhat necessary, but since 6317972cff9 (fetch: make the --prune-tags work with , 2018-02-09) these tests have been regular enough that we can always pass the "kept" argument for "link", and "pruned" for "name". Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 799e69dc1b1..5d118a6a806 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -1006,22 +1006,19 @@ test_configured_prune unset unset unset true pruned kept \ # remote. However, because there's no implicit # +refs/heads/*:refs/remotes/origin/* refspec and supplying it on the # command-line negates --prune-tags, the branches will not be pruned. +test_configured_prune_type_branch () { + test_configured_prune_type "$1" "$2" "$3" "$4" pruned "$6" "$7" "name" + test_configured_prune_type "$1" "$2" "$3" "$4" kept "$6" "$7" "link" +} test_configured_prune_type unset unset unset unset kept kept "origin --prune-tags" "name" test_configured_prune_type unset unset unset unset kept kept "origin --prune-tags" "link" -test_configured_prune_type unset unset unset unset pruned pruned "origin --prune --prune-tags" "name" -test_configured_prune_type unset unset unset unset kept pruned "origin --prune --prune-tags" "link" -test_configured_prune_type unset unset unset unset pruned pruned "--prune --prune-tags origin" "name" -test_configured_prune_type unset unset unset unset kept pruned "--prune --prune-tags origin" "link" -test_configured_prune_type unset unset true unset pruned pruned "--prune origin" "name" -test_configured_prune_type unset unset true unset kept pruned "--prune origin" "link" -test_configured_prune_type unset unset unset true pruned pruned "--prune origin" "name" -test_configured_prune_type unset unset unset true kept pruned "--prune origin" "link" -test_configured_prune_type true unset true unset pruned pruned "origin" "name" -test_configured_prune_type true unset true unset kept pruned "origin" "link" -test_configured_prune_type unset true true unset pruned pruned "origin" "name" -test_configured_prune_type unset true true unset kept pruned "origin" "link" -test_configured_prune_type unset true unset true pruned pruned "origin" "name" -test_configured_prune_type unset true unset true kept pruned "origin" "link" +test_configured_prune_type_branch unset unset unset unset - pruned "origin --prune --prune-tags" +test_configured_prune_type_branch unset unset unset unset - pruned "--prune --prune-tags origin" +test_configured_prune_type_branch unset unset true unset - pruned "--prune origin" +test_configured_prune_type_branch unset unset unset true - pruned "--prune origin" +test_configured_prune_type_branch true unset true unset - pruned "origin" +test_configured_prune_type_branch unset true true unset - pruned "origin" +test_configured_prune_type_branch unset true unset true - pruned "origin" # When all remote.origin.fetch settings are deleted a --prune # --prune-tags still implicitly supplies refs/tags/*:refs/tags/* so From patchwork Tue Jun 21 22:34:17 2022 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: 12889878 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 ECCD7C43334 for ; Tue, 21 Jun 2022 22:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354597AbiFUWeq (ORCPT ); Tue, 21 Jun 2022 18:34:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354486AbiFUWed (ORCPT ); Tue, 21 Jun 2022 18:34:33 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DC4412AAF for ; Tue, 21 Jun 2022 15:34:32 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id p6-20020a05600c1d8600b0039c630b8d96so88687wms.1 for ; Tue, 21 Jun 2022 15:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IJCHk6aWHo9U+yB8NT4lrI+LcdWFYKaN3lde/I6cJyk=; b=A7y3I12bact5YS2MBY+UWPvqeb5zFCUcvn9LcgWjC4+e4jyIz4D+1QWoxo+3WlK+lL wsN0471I8w6jH4YeWSQPuiMFmgbQERVbMyXuasN6UPPD/0ooSWenb8jhdkoOg+mFdKkJ WqiUIqBhtsfIJEwSkWR879Q6gOfxZQF3W7RxMLZ3cR3UBkDxCN8/oKD68iSkxt6AFUA9 kPzvkM7B7M1duVPFMnYQHG0iWpWuYhwibMX6zzm7Y8P2mY02Y7PMrOslFLEAT0NPyKZ+ F5OLyXYt/96mWIgDtVnQqoadUO92HEOaZjB7PN81XB9J8X/1haVLYA4HJ0trdXc3SfNj m98A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IJCHk6aWHo9U+yB8NT4lrI+LcdWFYKaN3lde/I6cJyk=; b=gv60dYdWQt/PWp1phTQIrUUKic2uFKAc95gi8VG/nTFF60WLe4MgGQ5SOleGp9wgqI X1wT4vnk00b2dIL7MZklo7JSEjiWpVzrWGji3Xjq/hcSTcLiDsJOzD5Tae97+L5Lpgdb ujv/f6YbQjW4jLX0vVqiKs3SksPS8yOt0BSO8wwVykA+a37SbHX6qiJDDJX0RKqtylOK +iUqD5wjLwse7M03BpOsQCzBv0D1fl7nUscb5Dzi/QAImIP8PpaPgfHB8PLFqrqLEOzR xOeA6GnW0pl22fyeiL7+Rl3YbY3JX2/tEznNqjWcZFV9mVPTSi23R4P2ZEU6rVvdft+P TvGg== X-Gm-Message-State: AJIora+1oGnPJF7wIV8OBBqx1U43fne/s49TdEpAuUjF8YWcCO6SHBu9 pqmWOCStG//HoaIne/XvVyIbv8H1XbUq7w== X-Google-Smtp-Source: AGRyM1tNrDpBgCEU55wqVel50Job+0zfhXYJOq373ueNhjTuU0bsXvWRYs5hviEBmzwOFUvDaM1mJg== X-Received: by 2002:a05:600c:a18a:b0:3a0:2978:30d2 with SMTP id id10-20020a05600ca18a00b003a0297830d2mr126713wmb.173.1655850870277; Tue, 21 Jun 2022 15:34:30 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:29 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 05/10] fetch tests: pass "mode" parameter first, pave way for "$@" Date: Wed, 22 Jun 2022 00:34:17 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the "$mode" parameter to be passed first, and setup a command-line parser we'll be able to use for getting rid of many of the boilerplate parameters. This will allow us to unquote the command-line argument, and process fetch arguments as a list of "$@". For now we need to do more work to unpack these, but in a subsequent commit we'll be able to make the shell quote handling here much simpler. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 5d118a6a806..477b6dd4953 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -822,14 +822,29 @@ set_config_tristate () { } test_configured_prune_type () { + mode= && + while test $# != 0 + do + case "$1" in + --mode) + mode="$2" && + shift + ;; + *) + break + ;; + esac && + shift + done && + local fetch_prune="$1" && local remote_origin_prune="$2" && local fetch_prune_tags="$3" && local remote_origin_prune_tags="$4" && local expected_branch="$5" && local expected_tag="$6" && - local cmdline="$7" && - local mode="$8" && + shift 6 && + local cmdline="$@" && if test -z "$cmdline_setup" then @@ -915,8 +930,8 @@ test_configured_prune_type () { } test_configured_prune () { - test_configured_prune_type "$@" "name" && - test_configured_prune_type "$@" "link" + test_configured_prune_type --mode name "$@" && + test_configured_prune_type --mode link "$@" } # $1 config: fetch.prune @@ -1007,11 +1022,19 @@ test_configured_prune unset unset unset true pruned kept \ # +refs/heads/*:refs/remotes/origin/* refspec and supplying it on the # command-line negates --prune-tags, the branches will not be pruned. test_configured_prune_type_branch () { - test_configured_prune_type "$1" "$2" "$3" "$4" pruned "$6" "$7" "name" - test_configured_prune_type "$1" "$2" "$3" "$4" kept "$6" "$7" "link" + local cfg_fp="$1" && + local cfg_rnp="$2" && + local cfg_fpt="$3" && + local cfg_rnpt="$4" && + local arg_branch="$5" && + local arg_tag="$6" && + shift 6 && + + test_configured_prune_type --mode name "$cfg_fp" "$cfg_rnp" "$cfg_fpt" "$cfg_rnpt" pruned "$arg_tag" "$@" + test_configured_prune_type --mode link "$cfg_fp" "$cfg_rnp" "$cfg_fpt" "$cfg_rnpt" kept "$arg_tag" "$@" } -test_configured_prune_type unset unset unset unset kept kept "origin --prune-tags" "name" -test_configured_prune_type unset unset unset unset kept kept "origin --prune-tags" "link" +test_configured_prune_type --mode name unset unset unset unset kept kept "origin --prune-tags" +test_configured_prune_type --mode link unset unset unset unset kept kept "origin --prune-tags" test_configured_prune_type_branch unset unset unset unset - pruned "origin --prune --prune-tags" test_configured_prune_type_branch unset unset unset unset - pruned "--prune --prune-tags origin" test_configured_prune_type_branch unset unset true unset - pruned "--prune origin" @@ -1029,8 +1052,8 @@ test_expect_success 'remove remote.origin.fetch "one"' ' git config --unset-all remote.origin.fetch ) ' -test_configured_prune_type unset unset unset unset kept pruned "origin --prune --prune-tags" "name" -test_configured_prune_type unset unset unset unset kept pruned "origin --prune --prune-tags" "link" +test_configured_prune_type --mode name unset unset unset unset kept pruned "origin --prune --prune-tags" +test_configured_prune_type --mode link unset unset unset unset kept pruned "origin --prune --prune-tags" test_expect_success 'all boundary commits are excluded' ' test_commit base && From patchwork Tue Jun 21 22:34:18 2022 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: 12889879 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 B029FCCA473 for ; Tue, 21 Jun 2022 22:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354644AbiFUWer (ORCPT ); Tue, 21 Jun 2022 18:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354498AbiFUWef (ORCPT ); Tue, 21 Jun 2022 18:34:35 -0400 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 472BB654F for ; Tue, 21 Jun 2022 15:34:33 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id m1so13083906wrb.2 for ; Tue, 21 Jun 2022 15:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+0oSdohpO3qGXHk8coVTQclDrmp5AnR46JqB/ivlLeE=; b=b2kk1s1BBs40yUD3bpKMRInEGqKXChLKrCX/NzhVQVzQFl3kAmPWDXBnJ5yIw3UUqu 35WFM8SxgJesj0NonRvK4fW40asuHuoscLtINErGNY5XLVz7jnINBZJq7tI8Lihg1zp6 4ZecRZxDtA2PjqF1fI8v1y/dIoYIEMgGMjs5JHOoOnyzV6CwPROpLgzoMmzkyj+Jwmtc N9rmGNrsfYNJ7P1g/sKo/uXIYo7P3l+R+4RIYe3S+4hR29o1V2w+AY/B4IsXqbvHVqyx LPlpoGVBofBKPdWPAq8dp/ZKLSiWJKsnLOhzhIJb1cDs0DicbFALAbLFy6VFhm6/PVtT Ub7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+0oSdohpO3qGXHk8coVTQclDrmp5AnR46JqB/ivlLeE=; b=XAANr6WGAuQr6QI8JXUN7tFyKQfzIyWIRrzyxYqgnfaz+qwXcl20UYqqUDvVVLrmk2 MD4twRy7sTPb1EFCB45X5kITwLLfftOCbhtfAp1vidI4RuJxrGRJT9uueF2pUIsevmR/ rn9xGeTv2I9b5tr6x0yuQRRVom5jzVGs2UA+xMyBH0pMPcXT+Ih01OquNC33WO92SpVn CSe9yu2wOBhiM1AlC6UhNvvhL4eFxlR1y7WHJNa4kZsEaCNR3+xKbsrxwols8ZhpNpbj agWHNwbP/rqXhR4rzqMlWfjET8S+4iz2rW/saYe2ZIWq7ubX63RwHvM81yTZQCpBweIt 20Sg== X-Gm-Message-State: AJIora8FEyvEz4EQHfCaDPglrfQdrVmBocC1DOMMw9VqRT8oHhi78WPS cVqqy5wn9Xtfm0MUpDOUR6NiYNG8zd9t+A== X-Google-Smtp-Source: AGRyM1uj0JtxBMYTTbvulttgz+g9xDmZVljH/zzreM5/IaSbvBkU2eTlpu+V0pJtIHxtZVp5w/JVIA== X-Received: by 2002:adf:a51a:0:b0:21b:823c:ae02 with SMTP id i26-20020adfa51a000000b0021b823cae02mr212925wrb.25.1655850871335; Tue, 21 Jun 2022 15:34:31 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:30 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 06/10] fetch tests: pass a list, not a string of arguments Date: Wed, 22 Jun 2022 00:34:18 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Follow-up on the preceding commit where we've started to intercept these arguments as "$@" and pass them as a list, not as a string, before we'd only have a "$@" equivalent to "$1". We're still not doing anything really useful with these, but this is getting us towards fixing the quote handling in "test_configured_prune_type()". Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 116 +++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 477b6dd4953..c56a00f1a17 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -940,82 +940,82 @@ test_configured_prune () { # $4 config: remote..pruneTags # $5 expect: branch to be pruned? # $6 expect: tag to be pruned? -# $7 git-fetch $cmdline: +# $7... git-fetch $cmdline: # -# $1 $2 $3 $4 $5 $6 $7 -test_configured_prune unset unset unset unset kept kept "" -test_configured_prune unset unset unset unset kept kept "--no-prune" -test_configured_prune unset unset unset unset pruned kept "--prune" +# $1 $2 $3 $4 $5 $6 $7... +test_configured_prune unset unset unset unset kept kept +test_configured_prune unset unset unset unset kept kept --no-prune +test_configured_prune unset unset unset unset pruned kept --prune test_configured_prune unset unset unset unset kept pruned \ - "--prune origin refs/tags/*:refs/tags/*" + --prune origin "refs/tags/*:refs/tags/*" test_configured_prune unset unset unset unset pruned pruned \ - "--prune origin refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*" + --prune origin "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" -test_configured_prune false unset unset unset kept kept "" -test_configured_prune false unset unset unset kept kept "--no-prune" -test_configured_prune false unset unset unset pruned kept "--prune" +test_configured_prune false unset unset unset kept kept +test_configured_prune false unset unset unset kept kept --no-prune +test_configured_prune false unset unset unset pruned kept --prune -test_configured_prune true unset unset unset pruned kept "" -test_configured_prune true unset unset unset pruned kept "--prune" -test_configured_prune true unset unset unset kept kept "--no-prune" +test_configured_prune true unset unset unset pruned kept +test_configured_prune true unset unset unset pruned kept --prune +test_configured_prune true unset unset unset kept kept --no-prune -test_configured_prune unset false unset unset kept kept "" -test_configured_prune unset false unset unset kept kept "--no-prune" -test_configured_prune unset false unset unset pruned kept "--prune" +test_configured_prune unset false unset unset kept kept +test_configured_prune unset false unset unset kept kept --no-prune +test_configured_prune unset false unset unset pruned kept --prune -test_configured_prune false false unset unset kept kept "" -test_configured_prune false false unset unset kept kept "--no-prune" -test_configured_prune false false unset unset pruned kept "--prune" +test_configured_prune false false unset unset kept kept +test_configured_prune false false unset unset kept kept --no-prune +test_configured_prune false false unset unset pruned kept --prune test_configured_prune false false unset unset kept pruned \ - "--prune origin refs/tags/*:refs/tags/*" + --prune origin "refs/tags/*:refs/tags/*" test_configured_prune false false unset unset pruned pruned \ - "--prune origin refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*" + --prune origin "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" -test_configured_prune true false unset unset kept kept "" -test_configured_prune true false unset unset pruned kept "--prune" -test_configured_prune true false unset unset kept kept "--no-prune" +test_configured_prune true false unset unset kept kept +test_configured_prune true false unset unset pruned kept --prune +test_configured_prune true false unset unset kept kept --no-prune -test_configured_prune unset true unset unset pruned kept "" -test_configured_prune unset true unset unset kept kept "--no-prune" -test_configured_prune unset true unset unset pruned kept "--prune" +test_configured_prune unset true unset unset pruned kept +test_configured_prune unset true unset unset kept kept --no-prune +test_configured_prune unset true unset unset pruned kept --prune -test_configured_prune false true unset unset pruned kept "" -test_configured_prune false true unset unset kept kept "--no-prune" -test_configured_prune false true unset unset pruned kept "--prune" +test_configured_prune false true unset unset pruned kept +test_configured_prune false true unset unset kept kept --no-prune +test_configured_prune false true unset unset pruned kept --prune -test_configured_prune true true unset unset pruned kept "" -test_configured_prune true true unset unset pruned kept "--prune" -test_configured_prune true true unset unset kept kept "--no-prune" +test_configured_prune true true unset unset pruned kept +test_configured_prune true true unset unset pruned kept --prune +test_configured_prune true true unset unset kept kept --no-prune test_configured_prune true true unset unset kept pruned \ - "--prune origin refs/tags/*:refs/tags/*" + --prune origin "refs/tags/*:refs/tags/*" test_configured_prune true true unset unset pruned pruned \ - "--prune origin refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*" + --prune origin "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" # --prune-tags on its own does nothing, needs --prune as well, same # for fetch.pruneTags without fetch.prune -test_configured_prune unset unset unset unset kept kept "--prune-tags" -test_configured_prune unset unset true unset kept kept "" -test_configured_prune unset unset unset true kept kept "" +test_configured_prune unset unset unset unset kept kept --prune-tags +test_configured_prune unset unset true unset kept kept +test_configured_prune unset unset unset true kept kept # These will prune the tags -test_configured_prune unset unset unset unset pruned pruned "--prune --prune-tags" -test_configured_prune true unset true unset pruned pruned "" -test_configured_prune unset true unset true pruned pruned "" +test_configured_prune unset unset unset unset pruned pruned --prune --prune-tags +test_configured_prune true unset true unset pruned pruned +test_configured_prune unset true unset true pruned pruned # remote..pruneTags overrides fetch.pruneTags, just like # remote..prune overrides fetch.prune if set. -test_configured_prune true unset true unset pruned pruned "" -test_configured_prune false true false true pruned pruned "" -test_configured_prune true false true false kept kept "" +test_configured_prune true unset true unset pruned pruned +test_configured_prune false true false true pruned pruned +test_configured_prune true false true false kept kept # When --prune-tags is supplied it's ignored if an explicit refspec is # given, same for the configuration options. test_configured_prune unset unset unset unset pruned kept \ - "--prune --prune-tags origin +refs/heads/*:refs/remotes/origin/*" + --prune --prune-tags origin "+refs/heads/*:refs/remotes/origin/*" test_configured_prune unset unset true unset pruned kept \ - "--prune origin +refs/heads/*:refs/remotes/origin/*" + --prune origin "+refs/heads/*:refs/remotes/origin/*" test_configured_prune unset unset unset true pruned kept \ - "--prune origin +refs/heads/*:refs/remotes/origin/*" + --prune origin "+refs/heads/*:refs/remotes/origin/*" # Pruning that also takes place if a file:// url replaces a named # remote. However, because there's no implicit @@ -1033,15 +1033,15 @@ test_configured_prune_type_branch () { test_configured_prune_type --mode name "$cfg_fp" "$cfg_rnp" "$cfg_fpt" "$cfg_rnpt" pruned "$arg_tag" "$@" test_configured_prune_type --mode link "$cfg_fp" "$cfg_rnp" "$cfg_fpt" "$cfg_rnpt" kept "$arg_tag" "$@" } -test_configured_prune_type --mode name unset unset unset unset kept kept "origin --prune-tags" -test_configured_prune_type --mode link unset unset unset unset kept kept "origin --prune-tags" -test_configured_prune_type_branch unset unset unset unset - pruned "origin --prune --prune-tags" -test_configured_prune_type_branch unset unset unset unset - pruned "--prune --prune-tags origin" -test_configured_prune_type_branch unset unset true unset - pruned "--prune origin" -test_configured_prune_type_branch unset unset unset true - pruned "--prune origin" -test_configured_prune_type_branch true unset true unset - pruned "origin" -test_configured_prune_type_branch unset true true unset - pruned "origin" -test_configured_prune_type_branch unset true unset true - pruned "origin" +test_configured_prune_type --mode name unset unset unset unset kept kept origin --prune-tags +test_configured_prune_type --mode link unset unset unset unset kept kept origin --prune-tags +test_configured_prune_type_branch unset unset unset unset - pruned origin --prune --prune-tags +test_configured_prune_type_branch unset unset unset unset - pruned --prune --prune-tags origin +test_configured_prune_type_branch unset unset true unset - pruned --prune origin +test_configured_prune_type_branch unset unset unset true - pruned --prune origin +test_configured_prune_type_branch true unset true unset - pruned origin +test_configured_prune_type_branch unset true true unset - pruned origin +test_configured_prune_type_branch unset true unset true - pruned origin # When all remote.origin.fetch settings are deleted a --prune # --prune-tags still implicitly supplies refs/tags/*:refs/tags/* so @@ -1052,8 +1052,8 @@ test_expect_success 'remove remote.origin.fetch "one"' ' git config --unset-all remote.origin.fetch ) ' -test_configured_prune_type --mode name unset unset unset unset kept pruned "origin --prune --prune-tags" -test_configured_prune_type --mode link unset unset unset unset kept pruned "origin --prune --prune-tags" +test_configured_prune_type --mode name unset unset unset unset kept pruned origin --prune --prune-tags +test_configured_prune_type --mode link unset unset unset unset kept pruned origin --prune --prune-tags test_expect_success 'all boundary commits are excluded' ' test_commit base && From patchwork Tue Jun 21 22:34:19 2022 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: 12889880 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 0CC0EC433EF for ; Tue, 21 Jun 2022 22:34:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354653AbiFUWer (ORCPT ); Tue, 21 Jun 2022 18:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354499AbiFUWef (ORCPT ); Tue, 21 Jun 2022 18:34:35 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B53B12D01 for ; Tue, 21 Jun 2022 15:34:34 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id s1so20838263wra.9 for ; Tue, 21 Jun 2022 15:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LiK60wxSbl1QKAxSNxR7J6zIrMfZjT4ZMq16GMAW/Xc=; b=MOldqQKwMgZ1ccffcCxlcXF15FZ5Nhd6yURdrowN64DN+tHD7PXEY7QMxCoOTQIkcO GupGS1CK6c9GS/CkLkGoRF8MOVZ4fQasTaLcEkgm8W0UTfnox0pHalXuWIg/EfVq8Pmx MpjsIq5PBQPAFV1zvB/RoS7t1PNoXOikLrIi3AvQdwqbH3wIJY9qZ3CRsarUC0nyr6C2 eCTYKEWdI6B/5PA1d0e0AcxjPTrAjgOoYjVmg5hKjuItuAb+k5RD24EBx2aKCTi4Gbb5 yZvERmhh+YijPXdb95P1seouLTwARoJjD1D7FSIWPw8FdH4737Bjoho4Aw8g/0EGfZ2v /L2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LiK60wxSbl1QKAxSNxR7J6zIrMfZjT4ZMq16GMAW/Xc=; b=sz0h+se/zOrNiyhImEq5z85wy+1XDTGL9HA7C9tSSnCdtUGIs2QoRelh0cV/e8m9WE hVOnF+ri04Mlf2GlLjdWwOzJAYa1HgYFcSWAFiViW9JegmTlfKPpmBHM3CfuEVMn2kWF 3+NAK+gqZHSMluQkbuwSbs7YLwO82OIDxxdziEZkVmAsilk9XmSy+RgnGdyeo74IGabG dUcf0q1tijOG1QQVp2EsNd7j9SRtH7cIFIkybynHpF2crgyJYZUeFmGV42WvHKA+mGZh cdXBhMn4w9kcDTo8kjqhUBpGmkDuRWByBFEx3BzT9iZOZSbkUn8703j81rgwalOh+LhT DK3A== X-Gm-Message-State: AJIora9jcYkeAkxRyiA3eVkHGb1E2hdNJOExkH13u90WuUKC7rAn8n8T 1yY/k8TxMWHMA0SFrRGcR+9KhzyjNrhWbA== X-Google-Smtp-Source: AGRyM1vNVe7G8eJ9RXJHyjxDMu7T8tIyy7BRzbD2Sqw6MHWA3TceZS3oe8EDPijM8ED0kXVJcF1D3g== X-Received: by 2002:a5d:43cd:0:b0:21b:8e53:befe with SMTP id v13-20020a5d43cd000000b0021b8e53befemr197724wrr.255.1655850872419; Tue, 21 Jun 2022 15:34:32 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:31 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 07/10] fetch tests: remove lazy variable setup Date: Wed, 22 Jun 2022 00:34:19 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the lazy test setup added in e1790f9245f (fetch tests: fetch as well as fetch [], 2018-02-09) to make it clear that these variables aren't changing across runs. We can also do away with the shell invocations here, but let's do that in a subsequent commit, for now this shows that it's safe to do this more than once. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index c56a00f1a17..7cfef0082c0 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -846,14 +846,9 @@ test_configured_prune_type () { shift 6 && local cmdline="$@" && - if test -z "$cmdline_setup" - then - test_expect_success 'setup cmdline_setup variable for subsequent test' ' - remote_url="file://$(git -C one config remote.origin.url)" && - remote_fetch="$(git -C one config remote.origin.fetch)" && - cmdline_setup="\"$remote_url\" \"$remote_fetch\"" - ' - fi && + remote_url="file://$(git -C one config remote.origin.url)" && + remote_fetch="$(git -C one config remote.origin.fetch)" && + cmdline_setup="\"$remote_url\" \"$remote_fetch\"" && if test "$mode" = 'link' then From patchwork Tue Jun 21 22:34:20 2022 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: 12889881 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 2D232C43334 for ; Tue, 21 Jun 2022 22:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354669AbiFUWet (ORCPT ); Tue, 21 Jun 2022 18:34:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354458AbiFUWeo (ORCPT ); Tue, 21 Jun 2022 18:34:44 -0400 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 3769F28707 for ; Tue, 21 Jun 2022 15:34:35 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id m39-20020a05600c3b2700b0039c511ebbacso10016177wms.3 for ; Tue, 21 Jun 2022 15:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3dhW6IuVN4st0XhvSoYU+v/1c1DdOSoK4mZEceAMIdc=; b=Y5w2AbrwwRGqQRxijSx/wZ0O4pdc0bSJi9GrWqfCG1DjZf/bqQ9mJetfu27agOeOt/ VWxivJE6IavZpy0rDmFe450rwG0m3QDVStVOY6Lp9RpstOJCrW1WS0FR3vhzQbMkusX6 85XiDRDSfGDKlxvwu6gFLv7EOtJK6HSkeq2VoouOO1FI2N+M26FZVIggroC342zAfBa8 BpK5WgFC/eSsHjsqTJu54m4IHA8SIMIHSIzoMXBNbETeK3QQzsrMit/AvRAdHD39WH6J GEv5lR0za2ZA+vRLX1Ml4AWm4AgZWQWdUSd6e0Kjiu7xPIGF36BXiZdDgBfRmSmmcMv1 4a7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3dhW6IuVN4st0XhvSoYU+v/1c1DdOSoK4mZEceAMIdc=; b=4JawP+GDEYB22esngJNYYS8zd1lEZVeiIh1G3mvn2hSJAYXgPvm9shHnmoJl6r/i0l +XxWCiS7f+F+gf2Sfooic4+YXER8XmBqGEocQg18bP4zB5FFf9hBl5s0kJenilWvewDI Tg8mfoNzU9jOkKtFCSlxyriedcIzBLe8FsPr3p8cp7u57CqdBrg7OtjccjfZG6uPR0y/ xNU3N6rkiYhbNWoyIH4cp1StQrrap3D/F1T+rnmK1WUw8VMKC89Y2AlJVPkvL4ANhOdU MlSWJ+ISrwtI2140DUlTdIEE2LFrD9WPB1UNTc+TL8TSbZmmQddX/mRT+x8yTEIl9Uuj qyyw== X-Gm-Message-State: AJIora8yiYweHC6qG4c4qfXtfnP4iDOP0SzVmWzF8O6cv5BuWgCIvO9n cqgozsbGtf2Sxj3ZmlZzn5LotTaW/4OzvA== X-Google-Smtp-Source: AGRyM1sx8zfaa+5jG3QoTEoMpsrDInezzsB684/eytawt9RvqxmVI6kBhW3cdgpIQbVWL2gUuWKW6w== X-Received: by 2002:a05:600c:35d2:b0:397:84c9:6fe8 with SMTP id r18-20020a05600c35d200b0039784c96fe8mr403444wmq.206.1655850873486; Tue, 21 Jun 2022 15:34:33 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:32 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 08/10] fetch tests: remove shelling out for previously "lazy" variables Date: Wed, 22 Jun 2022 00:34:20 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Amend the variable assignments added in e1790f9245f (fetch tests: fetch as well as fetch [], 2018-02-09). As of the last commit this test was slower as we'd do this on every run, but it was easier to see what was going on. But let's instead set this on the basis of $TRASH_DIRECTORY, which is a lot more obvious than the roundabout way of getting the configuration from the repo that we created earlier with: git clone . one Subsequent commits will make use of the new "$refspec_heads" for other purposes, so let's declare it as a variable, and use it instead of "$remote_fetch". Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 7cfef0082c0..54c7c86e5ca 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -837,6 +837,8 @@ test_configured_prune_type () { shift done && + local refspec_heads='+refs/heads/*:refs/remotes/origin/*' && + local fetch_prune="$1" && local remote_origin_prune="$2" && local fetch_prune_tags="$3" && @@ -846,9 +848,8 @@ test_configured_prune_type () { shift 6 && local cmdline="$@" && - remote_url="file://$(git -C one config remote.origin.url)" && - remote_fetch="$(git -C one config remote.origin.fetch)" && - cmdline_setup="\"$remote_url\" \"$remote_fetch\"" && + local remote_url="file://$TRASH_DIRECTORY/." && + local cmdline_setup="\"$remote_url\" \"$refspec_heads\"" if test "$mode" = 'link' then From patchwork Tue Jun 21 22:34:21 2022 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: 12889882 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 2A08FC43334 for ; Tue, 21 Jun 2022 22:34:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354673AbiFUWeu (ORCPT ); Tue, 21 Jun 2022 18:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354526AbiFUWep (ORCPT ); Tue, 21 Jun 2022 18:34:45 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27DB23192D for ; Tue, 21 Jun 2022 15:34:36 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id g27so14204272wrb.10 for ; Tue, 21 Jun 2022 15:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nHjHBrnJ9yL8cs8HygyLBsO4SU8yrNNllBswIAnUnqQ=; b=qj+BAbX4eF6IDWc8ygC6NNfoWte6nw5BGvzRdUAQ7k7yrLcfLRdgrX8fX2ofUahE5a dX91qBJMNZcttz2AtELbiWVALzTRCdhw8BqUENzErpEuv8g+4nb4+PFbYdBSxBYls53Q 1rQlFKVeJAMpl23c2f6LMHpXofhak0vUxRiRHh+5SpgDdr0hWG7lWmXTRUXn4bWlE04N mlfbe6Yk/G36FpVi+XbiNrP3HMw0pAqkpuWkWXAHi7+bLLP3bl+YftlsRzNr7F3LH55f xlflOHXwkcM0wfD0Yi5q9JVzVucsCSuY7WjFrOR/BTRUAGgtBl+aJdPE+I1qR/zGds9D VMXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nHjHBrnJ9yL8cs8HygyLBsO4SU8yrNNllBswIAnUnqQ=; b=OVsQeVQAT67wPqmDiwwunK31POD9UTHN91uVHe1NhA/uV1GY3zg4ctaw6wEB4f2pWV OFd/0PEjriR9twr05rtB5BHZ/QIHDHzx2jyIxwHr7rHSlQz6ixMzS2+RQyVGNkQIH5hR 8WmT+V2zAkY+XUiTFbXjcjdJOcAPzYf1cYxInMCDtU18gsE3FJ8swrM8SiYmBHQQhyMN PA+R/0J4HooFYzoz0E+xBx8ban0U/C81LjcCuLoMeVnw/LlqMOVQmd0RcFwnqIDbBt4B 9oqGi+czmFIce4OEzX3GwNi6QaKbwwJr3o8oIyVQ70f3fR1r1rySFpxBIWLMxkeRWyl+ Svkg== X-Gm-Message-State: AJIora9sa5lzegjspz7MD5rAUMapeSYHdPQR5HaKTPn46ajKGDPrm6ZA YiMAlLjCD8NOGb+AfdT1nT1/8Mf9n6rQSg== X-Google-Smtp-Source: AGRyM1stDGZnfyfD086gmvD75B3IQYgiCSe+/fNkmgbuVdTjFdO9MkTFToatJWDSXLxqKrAS7zKiNQ== X-Received: by 2002:adf:d1c6:0:b0:218:4fc3:a805 with SMTP id b6-20020adfd1c6000000b002184fc3a805mr219969wrd.228.1655850874405; Tue, 21 Jun 2022 15:34:34 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:33 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 09/10] fetch tests: stop implicitly adding refspecs Date: Wed, 22 Jun 2022 00:34:21 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the implicit behavior added in 97716d217c1 (fetch: add a --prune-tags option and fetch.pruneTags config, 2018-02-09) of providing the heads/tags refspecs and the "$remote_url" for tests that needed the "--mode link". In that case we need the URI on the command-line, and would then add these refspecs. Note that this was added in other cases, but these are the only ones where it mattered, i.e. we redundantly modified the command-line before. Yes, the "\"$remote_url\"" quoting here is buggy, but so is the pre-image in the same way, but removing this edge case will make it easier to eventually deal with that. So let's make that variable non-local for now and pass it in. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 54c7c86e5ca..73964bebced 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -848,7 +848,7 @@ test_configured_prune_type () { shift 6 && local cmdline="$@" && - local remote_url="file://$TRASH_DIRECTORY/." && + remote_url="file://$TRASH_DIRECTORY/." && # NOT local yet! local cmdline_setup="\"$remote_url\" \"$refspec_heads\"" if test "$mode" = 'link' @@ -862,15 +862,6 @@ test_configured_prune_type () { new_cmdline=$(printf "%s" "$cmdline" | perl -pe 's[origin(?!/)]["'"$remote_url"'"]g') fi && - if test "$fetch_prune_tags" = 'true' || - test "$remote_origin_prune_tags" = 'true' - then - if ! printf '%s' "$cmdline\n" | grep -q refs/remotes/origin/ - then - new_cmdline="$new_cmdline refs/tags/*:refs/tags/*" - fi - fi && - cmdline="$new_cmdline" fi && @@ -990,19 +981,36 @@ test_configured_prune true true unset unset pruned pruned \ # --prune-tags on its own does nothing, needs --prune as well, same # for fetch.pruneTags without fetch.prune test_configured_prune unset unset unset unset kept kept --prune-tags -test_configured_prune unset unset true unset kept kept -test_configured_prune unset unset unset true kept kept +test_configured_prune_type --mode name unset unset true unset kept kept +test_configured_prune_type --mode link unset unset true unset kept kept \ + origin "refs/tags/*:refs/tags/*" +test_configured_prune_type --mode name unset unset unset true kept kept +test_configured_prune_type --mode link unset unset unset true kept kept \ + origin "refs/tags/*:refs/tags/*" # These will prune the tags test_configured_prune unset unset unset unset pruned pruned --prune --prune-tags -test_configured_prune true unset true unset pruned pruned -test_configured_prune unset true unset true pruned pruned + +test_configured_prune_type --mode name true unset true unset pruned pruned +test_configured_prune_type --mode link true unset true unset pruned pruned \ + "\"$remote_url\"" \ + "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" +test_configured_prune_type --mode name unset true unset true pruned pruned +test_configured_prune_type --mode link unset true unset true pruned pruned \ + "\"$remote_url\"" \ + "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" # remote..pruneTags overrides fetch.pruneTags, just like # remote..prune overrides fetch.prune if set. -test_configured_prune true unset true unset pruned pruned -test_configured_prune false true false true pruned pruned -test_configured_prune true false true false kept kept +test_configured_prune_type --mode name true unset true unset pruned pruned +test_configured_prune_type --mode link true unset true unset pruned pruned \ + "\"$remote_url\"" \ + "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" +test_configured_prune_type --mode name false true false true pruned pruned +test_configured_prune_type --mode link false true false true pruned pruned \ + "\"$remote_url\"" \ + "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" +test_configured_prune true false true false kept kept # When --prune-tags is supplied it's ignored if an explicit refspec is # given, same for the configuration options. From patchwork Tue Jun 21 22:34:22 2022 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: 12889883 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 1D233C433EF for ; Tue, 21 Jun 2022 22:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354684AbiFUWey (ORCPT ); Tue, 21 Jun 2022 18:34:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354549AbiFUWep (ORCPT ); Tue, 21 Jun 2022 18:34:45 -0400 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 5974D3191D for ; Tue, 21 Jun 2022 15:34:37 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id m32-20020a05600c3b2000b0039756bb41f2so7966084wms.3 for ; Tue, 21 Jun 2022 15:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3+y64IDAFKqKJmjhRU6m/ZMh6o5iKfBKsykj2H+GEVg=; b=dpqd+OXPHERo7uZ6GK3AsLXWAC52FayXoHnjqHqzo5jI5BQXxvga+UsoTRKQysz0j0 OM4vZhwkAq/DOWQb9MgIjDKTaC1hKLU12+JzJhKy9eixZivJazOT8QQ4+pOaCerVTwUL lihbd6Oc6YHOEughiYi4FZacdyGUHwjrc0y+GWXVFfxPnTo8filNmjVM5J19RjFXR03H 6C7a+mXmytwecijxrvcSU6TOVy/AwPnrX/WD3bBVsVOHoEGtszkOW7PftVofgX9GE75o GgY59xrT+oTup2ZzmffAm/NDX8LEK5PDJqprJqfpAEmkmoQ12fEsz1ywXt1/v0FHawhE BtMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3+y64IDAFKqKJmjhRU6m/ZMh6o5iKfBKsykj2H+GEVg=; b=bicMxXTSRYNsLBNcPO06CR/yegiaDD+Y4ZgEd1IQiXG8o0V9CM/dVeDFd4m4J7sgsH xKoLq9Uh2Ry+ypRr2p/hf7k2Ba3bJZ9IL1LsT7KCesWzliy6gTw/aEPIkyAU48lQDTjS kH/G86d0DSjt840HlMarQnflWjQgIOvJcTrCA5JOZX5eE73a46yx6A0MUfUz1hvhHm7J B4ZXjsxFT5rDVVDAQ0D7Ya99HzadUruvNLTMqUWOdu8jHpoBFwTz4RfGZj3GYnDBG/Df m9+GH9xryfx+UvG4lNoO/CBBpAhdMYNB1tNBin0vDLKPW7Fp/2Eol7pZIG+EhxlKPHLX nmbQ== X-Gm-Message-State: AOAM531D5vNx3F3IjDoX8Or88dRdrilBBeiJNbv08gBAjSdkZmVDe590 ubhC2+t/lB/V6w4pejOJCHM/Rf/2O9bXBA== X-Google-Smtp-Source: ABdhPJytkADJzKi9FaIKHN6WX6oDXRlIL6kvQ4FL/ySDp+hw4N7rfRzAyZqk+zQX5NIjvJUVdYk9lQ== X-Received: by 2002:a05:600c:354c:b0:39c:7e86:6ff5 with SMTP id i12-20020a05600c354c00b0039c7e866ff5mr43063353wmq.145.1655850875534; Tue, 21 Jun 2022 15:34:35 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y5-20020a7bcd85000000b0039c7c4a542csm19000299wmj.47.2022.06.21.15.34.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 15:34:34 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Derrick Stolee , rsbecker@nexbridge.com, =?utf-8?q?SZEDER_G=C3=A1bor?= , Johannes Sixt , Jeff King , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 10/10] fetch tests: fix needless and buggy re-quoting Date: Wed, 22 Jun 2022 00:34:22 +0200 Message-Id: X-Mailer: git-send-email 2.36.1.1239.gfba91521d90 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the test_configured_prune_type() function to take full advantage of its arguments being passed in as a list, rather than needing hacks to work around its quoting issues. When the test_configured_prune() function was implemented in 737c5a9cde7 (fetch: make --prune configurable, 2013-07-13) it passed in its arguments to "git fetch" as one argument (although at the time only one argument was passed).. Then in preparation for passing more arguments the first quoting hack was added in 82f34e03e91 (fetch tests: double quote a variable for interpolation, 2018-02-09), with e1790f9245f (fetch tests: fetch as well as fetch [], 2018-02-09) following after that. This was all to implement the "git fetch --prune-tags" feature in 97716d217c1 (fetch: add a --prune-tags option and fetch.pruneTags config, 2018-02-09). At the time the edge cases introduced by this quoting were a known issue, but the alternative was a larger refactoring of this test file. In preceding commits we've done that refactoring, so let's finally take advantage of it. As reported in [1] the existing workaround(s) weren't enough. We can now drop the "perl" (or "sed" or whatever, see [2]), this will also handle other cases, such as those mentioned in [3]. 1. https://lore.kernel.org/git/00a401d884d0$32885890$979909b0$@nexbridge.com/ 2. https://lore.kernel.org/git/495bd957-43dc-f252-657d-2969bb7ad5f3@github.com/ 3. https://lore.kernel.org/git/YrFwcL2dRS%2Fv7xAw@coredump.intra.peff.net/ Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t5510-fetch.sh | 79 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 73964bebced..730968d4cd7 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -837,6 +837,7 @@ test_configured_prune_type () { shift done && + local refspec_tags='refs/tags/*:refs/tags/*' && local refspec_heads='+refs/heads/*:refs/remotes/origin/*' && local fetch_prune="$1" && @@ -846,23 +847,59 @@ test_configured_prune_type () { local expected_branch="$5" && local expected_tag="$6" && shift 6 && - local cmdline="$@" && + local cmdline="" && + local arg_fetch_prune="" && + local arg_fetch_no_prune="" && + local arg_fetch_prune_tags="" && + local arg_fetch_origin="" && + local arg_fetch_url="" && + local arg_fetch_refspec_tags="" && + local arg_fetch_refspec_heads="" && + while test $# != 0 + do + cmdline="${cmdline:+$cmdline }$1" && + case "$1" in + --prune) + arg_fetch_prune=t + ;; + --no-prune) + arg_fetch_no_prune=t + ;; + --prune-tags) + arg_fetch_prune_tags=t + ;; + origin) + arg_fetch_origin=t + ;; + REMOTE_URL) + arg_fetch_url=t + ;; + $refspec_tags) + arg_fetch_refspec_tags=t + ;; + $refspec_heads) + arg_fetch_refspec_heads=t + ;; + *) + BUG "unknown argument: '$1'" + ;; + esac && + shift + done && - remote_url="file://$TRASH_DIRECTORY/." && # NOT local yet! - local cmdline_setup="\"$remote_url\" \"$refspec_heads\"" + local remote_url="file://$TRASH_DIRECTORY/." && if test "$mode" = 'link' then - new_cmdline="" && - if test -z "$cmdline" then - new_cmdline=$cmdline_setup - else - new_cmdline=$(printf "%s" "$cmdline" | perl -pe 's[origin(?!/)]["'"$remote_url"'"]g') - fi && - - cmdline="$new_cmdline" + arg_fetch_refspec_heads=t + arg_fetch_url=t + elif test -n "$arg_fetch_origin" + then + arg_fetch_origin= + arg_fetch_url=t + fi fi && test_expect_success "$mode prune fetch.prune=$fetch_prune remote.origin.prune=$remote_origin_prune fetch.pruneTags=$fetch_prune_tags remote.origin.pruneTags=$remote_origin_prune_tags${cmdline:+ $cmdline}; branch:$expected_branch tag:$expected_tag" ' @@ -871,7 +908,7 @@ test_configured_prune_type () { git tag -f newtag && ( cd one && - git fetch '"$cmdline_setup"' && + git fetch "$remote_url" "$refspec_heads" && git rev-parse --verify refs/remotes/origin/newbranch && git rev-parse --verify refs/tags/newtag ) && @@ -893,7 +930,15 @@ test_configured_prune_type () { then git_fetch_c="" fi && - git$git_fetch_c fetch '"$cmdline"' && + git$git_fetch_c fetch \ + ${arg_fetch_prune:+--prune} \ + ${arg_fetch_no_prune:+--no-prune} \ + ${arg_fetch_prune_tags:+--prune-tags} \ + ${arg_fetch_origin:+origin} \ + ${arg_fetch_url:+"$remote_url"} \ + ${arg_fetch_refspec_tags:+"refs/tags/*:refs/tags/*"} \ + ${arg_fetch_refspec_heads:+"+refs/heads/*:refs/remotes/origin/*"} && + case "$expected_branch" in pruned) test_must_fail git rev-parse --verify refs/remotes/origin/newbranch @@ -993,22 +1038,22 @@ test_configured_prune unset unset unset unset pruned pruned --prune --prune-tags test_configured_prune_type --mode name true unset true unset pruned pruned test_configured_prune_type --mode link true unset true unset pruned pruned \ - "\"$remote_url\"" \ + REMOTE_URL \ "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" test_configured_prune_type --mode name unset true unset true pruned pruned test_configured_prune_type --mode link unset true unset true pruned pruned \ - "\"$remote_url\"" \ + REMOTE_URL \ "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" # remote..pruneTags overrides fetch.pruneTags, just like # remote..prune overrides fetch.prune if set. test_configured_prune_type --mode name true unset true unset pruned pruned test_configured_prune_type --mode link true unset true unset pruned pruned \ - "\"$remote_url\"" \ + REMOTE_URL \ "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" test_configured_prune_type --mode name false true false true pruned pruned test_configured_prune_type --mode link false true false true pruned pruned \ - "\"$remote_url\"" \ + REMOTE_URL \ "refs/tags/*:refs/tags/*" "+refs/heads/*:refs/remotes/origin/*" test_configured_prune true false true false kept kept