From patchwork Sun Apr 23 13:46:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Rybak X-Patchwork-Id: 13221320 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 6C4BBC77B60 for ; Sun, 23 Apr 2023 13:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbjDWNq6 (ORCPT ); Sun, 23 Apr 2023 09:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjDWNq4 (ORCPT ); Sun, 23 Apr 2023 09:46:56 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE57E170A for ; Sun, 23 Apr 2023 06:46:55 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4ec81773d50so3534245e87.2 for ; Sun, 23 Apr 2023 06:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682257614; x=1684849614; 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=pLm95TUs3aC/0wFh7nGg1f7OSJvmaMbVKJivJlKaVvNZAb8XCMh5zETJ7Szn2J+A3k 58WAMS5OP7mNrgADE4hKpmEY+oojweM7AKd1IZEoNIUhKjfjsra4wzq6XhBLjNcWxinD fib4NQGRwUO2O6Hp970RpoHq15Lg4RgpxtDyu3u08XMtsTPFhuy2/h5L79aruNJH5XwF AadLze0I7tsXApBQcxPbqmUk5j/3PkI16XnAx51ez1JwyakOlpbsr0iPEvqJiXc+sA7w XENZS6HwNAz20J/PNsIErEDnatYlpIctpaDlpIKaOEjHoMXUuytqaitqvt/gTyPFxVds 3aIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682257614; x=1684849614; 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=gMNP80hk7+JIoU12k0ah17mn8TpVPBAnKQtyzwxJ5TP1fyZGT+fbpdPPqQp77RINTv R46y9Db/2SCi/SOiUQs53c1FTygUjhwoozAE5pD3Wg/BmzNsCx3jcNOZa7TRsXdV1S+S RaPR0KLQLgFuJy4ogt9eAD/P7Nz3TmuAzJUH8ZANHpVqtU0BWbvss032jCVgnuKcXCj+ Pbo/9xK+Q/7OD+bQM+9knFUp3G+XrZU8tvEeOr5dXLDBW1OStYUTwQUD+qI1S42DPLfM WngGaRLciUzm9DxFnho13UPH0SXPwEpm3yEProY4f+PTPdHrZT45KEIMwGS1Pm5BaTnr sRKQ== X-Gm-Message-State: AAQBX9ezv4kA7LZxBmd23Pea+p2NYs4yxFp3QnNV539C1OITisvSAghP hCJMr2K4n+CZlHc0qMQFByDqG1/fichwS+4XOi0= X-Google-Smtp-Source: AKy350Z3Z5P35qnuRAj2RC74bJHrckiyYEeoOsr4ioLLV2i6iPNfRdTXE8+WMDh1xF3NANHqHs2NHg== X-Received: by 2002:ac2:4910:0:b0:4ee:8ff3:c981 with SMTP id n16-20020ac24910000000b004ee8ff3c981mr2514927lfi.10.1682257613666; Sun, 23 Apr 2023 06:46:53 -0700 (PDT) Received: from titov.fritz.box ([195.246.120.55]) by smtp.gmail.com with ESMTPSA id j24-20020ac24558000000b004db3eff4b12sm1272641lfm.171.2023.04.23.06.46.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Apr 2023 06:46:53 -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 v3 1/3] t1300: drop duplicate test Date: Sun, 23 Apr 2023 15:46:47 +0200 Message-Id: <20230423134649.431783-2-rybak.a.v@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230423134649.431783-1-rybak.a.v@gmail.com> References: <20230418175034.982433-1-rybak.a.v@gmail.com> <20230423134649.431783-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 Sun Apr 23 13:46:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Rybak X-Patchwork-Id: 13221322 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 9F959C6FD18 for ; Sun, 23 Apr 2023 13:47:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbjDWNrB (ORCPT ); Sun, 23 Apr 2023 09:47:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbjDWNq5 (ORCPT ); Sun, 23 Apr 2023 09:46:57 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 870B7171E for ; Sun, 23 Apr 2023 06:46:56 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4edc114c716so3608343e87.1 for ; Sun, 23 Apr 2023 06:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682257614; x=1684849614; 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=oi6zT7cUZp5TjG6FeAWGz08gAKRCMODGlvDg10KYrhVYU/1xAq7FHBudl7o66WYyX6 lT0awPmp79bKVwGfB76lWaOpP+3Oy40E/wbApDaPJGECjUQYu8M9aARFJNxRnPsfmSAk 663yHYyHWou8hYJhEj5s8wPaAvYuh/vldzc0kpDqzIfZf+7Z0zAMuq5E9JDojN5rfpNO BOJTXD+PBv2nedhMlVqYI+zKNI4NWYo3c5v9zVKvICv09ZNFok8iGIwqFJ4kFME524Yg U5scHEkSh8b/68YTWn26xPNNJWRXWz0Exr1cQi5zCNyRiIgvWXvpLvseGoPtJaBYHC/m Q1Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682257614; x=1684849614; 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=eULnVZM12RBsIuME2cBN4BrdCBa2mqy3kXZH4R0PrJ3p8+r6ykpRCn5/vlBmLB+942 3RJlCbWNVQ8Tff0i3SExb9zqEh50jQ8yRawFGIlYvGJe83t9BOVLTtF24gZafDXHduWI vzb8GsbY0+6q71JnLq2uZ+hk4l/SZQ60OdRSvF6okeZevp+pemJQj6AAA24kymJ4BSzt tYnFpYn1Ks42nAmYzqOgblhQIGm9NY4M4Lg+0ll6CAbhyCk9vWN8ST79bf65pdVlSUm/ qO2vncbuUV9lJXv7olP/+j/cieD0OwolWKUnSNlBZmeNfm1S+9RugK6uBUU18pvQ82HQ cAeg== X-Gm-Message-State: AAQBX9fe2+WlHTPQoW6pZYvejeThEt90Cog4Q+816sufn0EirF9rnXgT wyq2W8X5WGWKD7lrZNfuOoWaMyr0GxiooSwbGFI= X-Google-Smtp-Source: AKy350YifDm9J4b8aNFNFzUBzkPuRVMakf3AQLjc/qxRU4bXqkqIqGQZpYhqlISVsEVbiuZWlXDqPg== X-Received: by 2002:a19:c518:0:b0:4eb:3b58:c558 with SMTP id w24-20020a19c518000000b004eb3b58c558mr2491605lfe.59.1682257614518; Sun, 23 Apr 2023 06:46:54 -0700 (PDT) Received: from titov.fritz.box ([195.246.120.55]) by smtp.gmail.com with ESMTPSA id j24-20020ac24558000000b004db3eff4b12sm1272641lfm.171.2023.04.23.06.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Apr 2023 06:46:54 -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 v3 2/3] t1300: check stderr for "ignores pairs" tests Date: Sun, 23 Apr 2023 15:46:48 +0200 Message-Id: <20230423134649.431783-3-rybak.a.v@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230423134649.431783-1-rybak.a.v@gmail.com> References: <20230418175034.982433-1-rybak.a.v@gmail.com> <20230423134649.431783-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 Sun Apr 23 13:46:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Rybak X-Patchwork-Id: 13221323 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 EC596C6FD18 for ; Sun, 23 Apr 2023 13:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229531AbjDWNrD (ORCPT ); Sun, 23 Apr 2023 09:47:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjDWNq6 (ORCPT ); Sun, 23 Apr 2023 09:46:58 -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 BE0EE170A for ; Sun, 23 Apr 2023 06:46:57 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4eca0563b31so3495151e87.1 for ; Sun, 23 Apr 2023 06:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682257616; x=1684849616; 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=yawSpfkFzgFl1q86Bi3J4ehwF2PSm+/QT8KDpSo1AUU=; b=XA5sDdmHP29e/k3L3dx8r/G2/bU6L/iCHmbuYOYIGtWTaeRHxG3dMTAQBZyoAS7Knu ymAjQ7KVQ+NvJSb8VEQeD9hPh6feDvO9uEJTt2V+R3f+uifMpzRQfrYG58nx8pkTuHZi 2EDsZC5C10W+OrYux/acv3Z/IPs5UrPAiNG59Z4BrrrAxDTXQTrdPWnsiFOvlb0pocra cbDeyQWu7DCi6SsOwMdhkTN5KWOnMR7OM81OqRJ6j30IEp9wuazma4he5KvUtb7HpOKh CQ/6e6l7jb8qixg+wmV9u6syk+pNZDvkK4SqHGubJJpEjFTypbhaDP/5d0/VFP7ylnzU dCMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682257616; x=1684849616; 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=yawSpfkFzgFl1q86Bi3J4ehwF2PSm+/QT8KDpSo1AUU=; b=dkpUcMEKeZAYHmPz32C8EwuXqaqN5m4jR0fC/FZI0zU+h00geTNJr/D2J4JbO5yDP4 3yxwb8uC6xcJKpBXd5qTjxjHpGpfx5pvqc3TR3p0V7NTzVD4u2UYoo181R9TLj8CHqGY Peefmt/P9DNn+hbicjHEuQx//AOwwRTfSW7Is3eEhBEOknNQCViXORjBYXb58s1CHdOu llqcQEexoFVOCoGBUzmuNCrIHJKstUK3d//ws2insmSTHGAuT/4JHheHZqVS8lV/mQqm gKtfPIr8JxFAUfMJMt34w1n4TT4mBPZYeTSn6hNI0Ypavad9erCqEaeyJ01qBNDn8CO4 TAaw== X-Gm-Message-State: AAQBX9fkyWChvIL/PYfIODbyFJpvjskJro+UOBZfFaxt1OEpjZIOlMgh 7frKUhWpfd8DVQWVDpC1jw8va/JXYLj4rajkOho= X-Google-Smtp-Source: AKy350YALSw1GPDPq60dW/hmULVbTTUio+ZCSmXgrOgjFyP+L9QdtUZcG3AStdunLqfrLfaORiGWqw== X-Received: by 2002:a19:5210:0:b0:4db:405f:d5c0 with SMTP id m16-20020a195210000000b004db405fd5c0mr2849776lfb.48.1682257615526; Sun, 23 Apr 2023 06:46:55 -0700 (PDT) Received: from titov.fritz.box ([195.246.120.55]) by smtp.gmail.com with ESMTPSA id j24-20020ac24558000000b004db3eff4b12sm1272641lfm.171.2023.04.23.06.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Apr 2023 06:46:55 -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 v3 3/3] t1300: add tests for missing keys Date: Sun, 23 Apr 2023 15:46:49 +0200 Message-Id: <20230423134649.431783-4-rybak.a.v@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230423134649.431783-1-rybak.a.v@gmail.com> References: <20230418175034.982433-1-rybak.a.v@gmail.com> <20230423134649.431783-1-rybak.a.v@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org There are 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 "
." and "
..". Signed-off-by: Andrei Rybak --- t/t1300-config.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/t/t1300-config.sh b/t/t1300-config.sh index 20a15ede5c..423948f384 100755 --- a/t/t1300-config.sh +++ b/t/t1300-config.sh @@ -98,6 +98,23 @@ 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' +test_missing_key 'section.MissingSubSection.missingkey' 'missing subsection and missing key' +test_missing_key 'section.SubSection.missingkey' 'existing subsection and missing key' +test_missing_key 'section.MissingSubSection.key' 'missing subsection and existing key' + cat > .git/config <<\EOF [alpha] bar = foo