From patchwork Tue Apr 18 17:50:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Rybak X-Patchwork-Id: 13216019 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 C2DE6C6FD18 for ; Tue, 18 Apr 2023 17:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232469AbjDRRus (ORCPT ); Tue, 18 Apr 2023 13:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232486AbjDRRum (ORCPT ); Tue, 18 Apr 2023 13:50:42 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80EA2D326 for ; Tue, 18 Apr 2023 10:50:41 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4ec9ccab8bbso2338528e87.2 for ; Tue, 18 Apr 2023 10:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681840239; x=1684432239; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j2unZZ0tkwjTB6Nef/MJvYMRgoZQUGroeYnEdH+E8r0=; b=Ib9lZ9PInm3TZjwfiX+mgm4Dvgke3Pwm2qSycENUawvrun5FaTDUNKiZb+EQzkJSRJ /kvyr5Na4x5TQSOtXPjk9BcLRYOA23TnVUwYBaYyFHGh3me8A7r1KvwyNNpLFg3uVC+M WExwNc6eLSqYI72iwNvDcWJzNqfSeSsWcgNRzGmjUTk9XP3YH2493bf4cR2sKNxwQInB JRp9y2ikjWuz6YRifrRwswA+JesHGmGvphIXqZCUxTsUevnTgnwbL1OUJcuhDAD5EVRp Iux3j+pn6X/y/qA8sxoLa6zz2AIPhgMd+idNt4WR9nbZtXSBrctClK6xkHplxjjtTzPp P1iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681840239; x=1684432239; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j2unZZ0tkwjTB6Nef/MJvYMRgoZQUGroeYnEdH+E8r0=; b=T6UrcC27dwWJwyBoAGV7mQExxwHUXpwgsa9ykdd3PZDUAl///Pd7MRFz4mAnSsiiTK s0iQxtPq0M7sCHQZ77wGSnDufMe55rceAlCGUoYqVsCNaDFumxGNfe9NY9NAcF3T1LFh oLK7pbZy9EZMvhjxIPU977u2qjP5M73wGjZhNuxV+3LVXq7QA//9VshHslP8/ZzSgnOF K+AbFGAEC9p12yjt3U7/1dZDr7cAeBaosMhTxZdN4qovS/fffqb59LNF5CBeW3rKDaCy ecIEenx7IcUuhwU1C0hgHXfPlBkl8akFL4Cu582UOEFmFFpTVR5jkAvphgHa8WOvkcoO Xufg== X-Gm-Message-State: AAQBX9cxnlvKo86mEhJQ+3R/NSNI85EEH91pYXXEOm+GMgHL8fqxffLa XBKYou4r436wsuvFtSoPukZ5V91nzdSjbCwS X-Google-Smtp-Source: AKy350bE8I0bK/eAH2s83nBO8ptw5i5HGFFxPnvyDwUQNOdCrk6F4oANhVUsma5Yp/rw4utesQIxDg== X-Received: by 2002:a19:ad4b:0:b0:4eb:680:391c with SMTP id s11-20020a19ad4b000000b004eb0680391cmr2955755lfd.10.1681840239313; Tue, 18 Apr 2023 10:50:39 -0700 (PDT) Received: from titov.fritz.box ([195.246.120.47]) by smtp.gmail.com with ESMTPSA id l20-20020a19c214000000b004ed149acc08sm2294998lfc.93.2023.04.18.10.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 10:50:38 -0700 (PDT) From: Andrei Rybak To: git@vger.kernel.org Cc: Patrick Steinhardt , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Johannes Schindelin , =?utf-8?q?=C3=98ystein_Wa?= =?utf-8?q?lle?= , Junio C Hamano Subject: [PATCH v2 1/3] t1300: drop duplicate test Date: Tue, 18 Apr 2023 19:50:32 +0200 Message-Id: <20230418175034.982433-2-rybak.a.v@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230418175034.982433-1-rybak.a.v@gmail.com> References: <20230414081352.810296-1-rybak.a.v@gmail.com> <20230418175034.982433-1-rybak.a.v@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There are two almost identical tests called 'git config ignores pairs with zero count' in file t1300-config.sh. Drop the first of these and keep the one that contains more assertions. Signed-off-by: Andrei Rybak --- t/t1300-config.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/t/t1300-config.sh b/t/t1300-config.sh index 2575279ab8..696dca17c6 100755 --- a/t/t1300-config.sh +++ b/t/t1300-config.sh @@ -1458,13 +1458,6 @@ test_expect_success 'git config ignores pairs without count' ' test_must_be_empty error ' -test_expect_success 'git config ignores pairs with zero count' ' - test_must_fail env \ - GIT_CONFIG_COUNT=0 \ - GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \ - git config pair.one -' - test_expect_success 'git config ignores pairs exceeding count' ' GIT_CONFIG_COUNT=1 \ GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \ From patchwork Tue Apr 18 17:50:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Rybak X-Patchwork-Id: 13216020 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 3CC8DC77B78 for ; Tue, 18 Apr 2023 17:50:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232500AbjDRRuu (ORCPT ); Tue, 18 Apr 2023 13:50:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231769AbjDRRuo (ORCPT ); Tue, 18 Apr 2023 13:50:44 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1279AF34 for ; Tue, 18 Apr 2023 10:50:42 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4ec8eca56cfso2374116e87.0 for ; Tue, 18 Apr 2023 10:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681840240; x=1684432240; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cS+eJAC+tQD6AE2KEtPmgNZ4XUTSlytBBlAUIfOxx0U=; b=L/mbGZlWuZs19zCgLOtud2T8Ch0K9hCg+un29u1G8TJEwmXk0s/3uBdfQgx1jFeraZ l2w+TWAQSRExAFQDI7pOohAbGSignmjxjXWV3nMTJjOhjqiWrk9YQkw8h+ZaFzeuhotf oHRC7ZcuAPmNfPmg5LaYBQ4yOUJGOEQYB3zsf9vUzlgGoZ+s0HKRppYoIlDB83C+RBPe 9GQJnoLl3+klSqUSH4PQmmiIbg/KS6xAw8bTf9pdNQURAVERbQYAcZ6pXzJ4x8Tu88yD qxzcrY24OGdgGqYafpHVZccBucLTbdkzYia3WZmJUTY1OO9K+cVwA7+0SKIGiwA8SMaE JMVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681840240; x=1684432240; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cS+eJAC+tQD6AE2KEtPmgNZ4XUTSlytBBlAUIfOxx0U=; b=jflPdXU1jP8xhwpzwEvv6tucuybxTAES96rSt4QnRZrQY1rouRo87DdVj05MENXIBa UzOElVum3/FqccKzDvHo0XO6TDZVOyNtSlEZe3wqBFHy2+NX9hT/5u4dDU9XRBmm+DYs cTIConoalctY9RwKL79Bpo9MrV9KIV5H1qsCYRaFtybOmYTU/6UXpDKczAG9kmfrniDd u2HumZeKEZ7ZJJ0xTx2MyDA4xQNnkvFSRIfni+YYGQBUkGl0QM5oaCnqs71n0owDd7fQ KSegwAsvQDNF7g+CckbkAKsn/i5za9IjspjVAiPLAeEDHrVQxVmstWKmlBU/gLEIJGxU /Txw== X-Gm-Message-State: AAQBX9cxsPXvitGp3dX/o0NUXslSepJgVRpbftgFro8e0tbMPPhsvkZM U35YxpeC8rE4MZqcjh+oRcjWZmrdsn6jWkxY X-Google-Smtp-Source: AKy350ZdloVvO6GEMN4VUbJv9gGqTMmJeh6Wnmx7hfHnMOe65uCQwLrBa5Hqzf8h71ad43s+KTPidQ== X-Received: by 2002:ac2:48b2:0:b0:4ed:c76b:6aaf with SMTP id u18-20020ac248b2000000b004edc76b6aafmr1755238lfg.56.1681840240354; Tue, 18 Apr 2023 10:50:40 -0700 (PDT) Received: from titov.fritz.box ([195.246.120.47]) by smtp.gmail.com with ESMTPSA id l20-20020a19c214000000b004ed149acc08sm2294998lfc.93.2023.04.18.10.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 10:50:39 -0700 (PDT) From: Andrei Rybak To: git@vger.kernel.org Cc: Patrick Steinhardt , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Johannes Schindelin , =?utf-8?q?=C3=98ystein_Wa?= =?utf-8?q?lle?= , Junio C Hamano Subject: [PATCH v2 2/3] t1300: check stderr for "ignores pairs" tests Date: Tue, 18 Apr 2023 19:50:33 +0200 Message-Id: <20230418175034.982433-3-rybak.a.v@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230418175034.982433-1-rybak.a.v@gmail.com> References: <20230414081352.810296-1-rybak.a.v@gmail.com> <20230418175034.982433-1-rybak.a.v@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Tests "git config ignores pairs ..." in t1300-config.sh validate that "git config" ignores various kinds of supplied pairs of environment variables GIT_CONFIG_KEY_* GIT_CONFIG_VALUE_* depending on GIT_CONFIG_COUNT. By "ignores" here we mean that "git config" abides by the value of environment variable GIT_CONFIG_COUNT and doesn't use key-value pairs outside of the supplied GIT_CONFIG_COUNT when trying to produce a value for config key "pair.one". These tests also validate that "git config" doesn't complain about mismatched environment variables to standard error. This is validated by redirecting the standard error to a file called "error" and asserting that it is empty. However, two of these tests incorrectly redirect to standard output while calling the file "error", and test 'git config ignores pairs exceeding count' doesn't validate standard error at all. Fix these tests by redirecting standard error to file "error" and asserting its emptiness. Signed-off-by: Andrei Rybak --- t/t1300-config.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/t/t1300-config.sh b/t/t1300-config.sh index 696dca17c6..20a15ede5c 100755 --- a/t/t1300-config.sh +++ b/t/t1300-config.sh @@ -1462,24 +1462,25 @@ test_expect_success 'git config ignores pairs exceeding count' ' GIT_CONFIG_COUNT=1 \ GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \ GIT_CONFIG_KEY_1="pair.two" GIT_CONFIG_VALUE_1="value" \ - git config --get-regexp "pair.*" >actual && + git config --get-regexp "pair.*" >actual 2>error && cat >expect <<-EOF && pair.one value EOF - test_cmp expect actual + test_cmp expect actual && + test_must_be_empty error ' test_expect_success 'git config ignores pairs with zero count' ' test_must_fail env \ GIT_CONFIG_COUNT=0 GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \ - git config pair.one >error && + git config pair.one 2>error && test_must_be_empty error ' test_expect_success 'git config ignores pairs with empty count' ' test_must_fail env \ GIT_CONFIG_COUNT= GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \ - git config pair.one >error && + git config pair.one 2>error && test_must_be_empty error ' From patchwork Tue Apr 18 17:50:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Rybak X-Patchwork-Id: 13216021 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 DD8B4C77B75 for ; Tue, 18 Apr 2023 17:50:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232571AbjDRRuw (ORCPT ); Tue, 18 Apr 2023 13:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232466AbjDRRuo (ORCPT ); Tue, 18 Apr 2023 13:50:44 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67985B762 for ; Tue, 18 Apr 2023 10:50:43 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2a8c30ac7e3so17122541fa.1 for ; Tue, 18 Apr 2023 10:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681840241; x=1684432241; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EUCLlPwd9WKNAu5sxSBSc3IBiXwMfJmYSm85JRQuIlQ=; b=IgPTrtNNSEzyR7vMKX2Eys63TyLI/R9RhK+L/4chS7hImUDgOefieBFH4GOVi3I8dE JrJa6WSc1zRGBo9Hds8LGHIWYYrdYTEflZFOSLUcG3JPKhH6N+T/j2R0CqS0QOCyJVST Dahbn1k423MSERZy2KY6DbQzSMxyO1TRaINoOk/MZ9oyjsVDqIJOV8CFSfCztqsz4mvD smj140s5NQd5RD3pKiHwEWVqFn+SddxLVKIWRTi1Qzj4UzwcnVATokV2uBC/FIxoP5V+ xTfFGqtJaHFxOJ32IOvlY92q6rPa+1XgEIcf0u+D94c6yvKdK2lsOF8w1vPCIIqcYciv Ahvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681840241; x=1684432241; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EUCLlPwd9WKNAu5sxSBSc3IBiXwMfJmYSm85JRQuIlQ=; b=H7RmDous4d8JAALlHBZdADdF4TMHiEPBEQYAZh36uBkbOMmzGJepIU3TYlW9St5720 nALBA6YqKHgY7sBqnOyAEGXQQ7QvhbeMMFkQsoVYF38dFRPak1ZjPN75mSeVw29NC5Eu 6S1kGq4D1YZdq6Z0axzZ63ZmitL81zlTDcEO5wK81IXUNZtWMH973t7mzgNKEzkpVjmH Kq3eefx0ac4C5KNd5sqHTGHlCZFCqWPxJRb7TSspOLBxh1kM05eGiXneZnNfre2uGNVF 4HVLBa1OQE+IXiQJTYmaLeB85wDS1Vxo1M/+cBzKWZX3+JOYJ5NVPdMHT/8KZNYRU0Ea kmEw== X-Gm-Message-State: AAQBX9dT1+tsC7I/jB8eGHhvFilyIG0rYQZ4wS3acSZHIXTgAQuePAJP tYyCscySeB23oEnWZHEqIpTsYpYCS3UpDisy X-Google-Smtp-Source: AKy350blzuTXnZv20UqYbt8RAxfTTuKAMLgdwDzlN79PCOOtgQCZUcS6Lde1kz23QvZcckTTcHxTnQ== X-Received: by 2002:a05:6512:38c7:b0:4ec:8cad:3c38 with SMTP id p7-20020a05651238c700b004ec8cad3c38mr2919086lft.50.1681840241304; Tue, 18 Apr 2023 10:50:41 -0700 (PDT) Received: from titov.fritz.box ([195.246.120.47]) by smtp.gmail.com with ESMTPSA id l20-20020a19c214000000b004ed149acc08sm2294998lfc.93.2023.04.18.10.50.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 10:50:40 -0700 (PDT) From: Andrei Rybak To: git@vger.kernel.org Cc: Patrick Steinhardt , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFy?= =?utf-8?b?bWFzb24=?= , Johannes Schindelin , =?utf-8?q?=C3=98ystein_Wa?= =?utf-8?q?lle?= , Junio C Hamano Subject: [RFC PATCH v2 3/3] t1300: add tests for missing keys Date: Tue, 18 Apr 2023 19:50:34 +0200 Message-Id: <20230418175034.982433-4-rybak.a.v@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230418175034.982433-1-rybak.a.v@gmail.com> References: <20230414081352.810296-1-rybak.a.v@gmail.com> <20230418175034.982433-1-rybak.a.v@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There several tests in t1300-config.sh that validate failing invocations of "git config". However, there are no tests that check what happens when "git config" is asked to retrieve a value for a missing key. Add tests that check this for various combinations of "
.". --- The patch is marked as RFC, because I'm not sure if such a test is useful or not. Even if it is not useful as a test, maybe it would be useful as documentation of behavior for people reading "t1300-config.sh"? Having multiple tests for different kinds of keys might also be overkill, and just one test for a single key is enough. Conversely, there aren't enough tests -- tests for keys with subsections are missing. t/t1300-config.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/t/t1300-config.sh b/t/t1300-config.sh index 20a15ede5c..a646ddd231 100755 --- a/t/t1300-config.sh +++ b/t/t1300-config.sh @@ -98,6 +98,20 @@ test_expect_success 'subsections are not canonicalized by git-config' ' test_cmp_config two section.SubSection.key ' +test_missing_key () { + local key=$1 + local title=$2 + test_expect_success "value for $title is not printed" " + test_must_fail git config $key >out 2>err && + test_must_be_empty out && + test_must_be_empty err + " +} + +test_missing_key 'missingsection.missingkey' 'missing section and missing key' +test_missing_key 'missingsection.penguin' 'missing section and existing key' +test_missing_key 'section.missingkey' 'existing section and missing key' + cat > .git/config <<\EOF [alpha] bar = foo