From patchwork Fri Dec 20 18:15:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306085 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF7D7109A for ; Fri, 20 Dec 2019 18:14:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AD26F2082E for ; Fri, 20 Dec 2019 18:14:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D8XD3mnL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727432AbfLTSOg (ORCPT ); Fri, 20 Dec 2019 13:14:36 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46863 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727391AbfLTSOf (ORCPT ); Fri, 20 Dec 2019 13:14:35 -0500 Received: by mail-pg1-f194.google.com with SMTP id z124so5306197pgb.13 for ; Fri, 20 Dec 2019 10:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SR1Way5k+Wj+6Ue6ejt0y/lCWjpKuXZoBOUBpag+XqM=; b=D8XD3mnLkbEfvCZF++0QTpAFnx2HkRxY+xY+Zq2u3YNTf9YDu0rUEkdPGBKUV3uGEp 9ZAldj6sQrsSILZWacoG8mHeRm8jn3QAC0Kf9ZXRMHUOuTSzrZzXqzK5BeIwDQ3htOR/ YjE1zTwfl2Uzeelz3P6HmO9vjYi7aCAgCltcyKcOXQPM7e9ORYI5YbcalBjOa5KFufa6 AmdqqG3JefnemfvDWqvDICE3U6ktc1kWxvoo9skQhJ1/ToPX5eNDOdv/ye2nCnThtiZK /jD503kaavMtsShMsoolqrUvzVIFy/UwKHTpomsxteRw3Jmt+vwOYUjsZFFb7V04j8Oe WIuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SR1Way5k+Wj+6Ue6ejt0y/lCWjpKuXZoBOUBpag+XqM=; b=eCRpa0/yF6LZnUozkzsfQDFebBmiFOG/kv60nC6qJOGMl/dMKbjRYyzQCsqI7aPTKG iwHWsk7xMP5S0+PMWjCTPYywkPeQVnx33XqBtOZLygql4UWSGRm4CbzEUaXoe6L8WMTA KNGwPe0+xi+soyUI5ummYT7I0t1zNCrbXc1jijuJuMOhpvogxrptButXArY5pfIW2TxR 2qoVt4oKhV6pkJvOTUe1noi5gWBWkc1AcQWDyD6RZDWVqyKs+MnRoymiWJ25t4FAXepY RUfiJIG3EsOEhpuFJ5LBuTC4XrvoMXo/FrFNDfF+auhanCnalEWzNXw/+vsWYTIKH0+Q X8HQ== X-Gm-Message-State: APjAAAU+aSy1Z77BL3hcZVsxWBqbxIj49q7+ikKvLSJEB5H7ITRfhl3f aBm2tE7/8pMWlzP+s3QBY0D33tK4 X-Google-Smtp-Source: APXvYqxIUcdJoW610TMygMBCzOsiOmbW+kvxZOyMyoYVCPjBJSu/ELVoX0MyhJSsNY43uaYDbINT2g== X-Received: by 2002:a63:3750:: with SMTP id g16mr16467579pgn.413.1576865674585; Fri, 20 Dec 2019 10:14:34 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:34 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 01/15] t/lib-git-p4: use test_path_is_missing() Date: Fri, 20 Dec 2019 10:15:48 -0800 Message-Id: X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Previously, cleanup_git() would use `test_must_fail test -d` to ensure that the directory is removed. However, test_must_fail should only be used for git commands. Use test_path_is_missing() instead to check that the directory has been removed. Signed-off-by: Denton Liu --- t/lib-git-p4.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh index 547b9f88e1..5aff2abe8b 100644 --- a/t/lib-git-p4.sh +++ b/t/lib-git-p4.sh @@ -175,7 +175,7 @@ stop_and_cleanup_p4d () { cleanup_git () { retry_until_success rm -r "$git" - test_must_fail test -d "$git" && + test_path_is_missing "$git" && retry_until_success mkdir "$git" } From patchwork Fri Dec 20 18:15:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306087 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 88E3117EF for ; Fri, 20 Dec 2019 18:14:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 676192064B for ; Fri, 20 Dec 2019 18:14:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LEEZc6Am" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727438AbfLTSOh (ORCPT ); Fri, 20 Dec 2019 13:14:37 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:55959 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727391AbfLTSOg (ORCPT ); Fri, 20 Dec 2019 13:14:36 -0500 Received: by mail-pj1-f67.google.com with SMTP id d5so4439910pjz.5 for ; Fri, 20 Dec 2019 10:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/cHz9jXRyGP9I2nk3E8zlqOrVEHelcTSO/s6fkRs/BM=; b=LEEZc6Amvb3s1lthQgg8WV6PmqeKOniVg5CM4m9MqQMd9Sgkfe3do3nx9so1oTlQ61 z6E019Zs/4DcuVFu8yRHh2kqEPnzlckCxvQq1HvSP0hq7ocq64Xu7lXpNTSmzDVEojSx 2dqnzVK96FPdaOli/xMC32GJkZ4VWKizxiC4LOgklMLWt932cQLGryNXga8AaHC8HcEO W0XUL5u4NGoGtsirQVFOJ7lvLBvPOLEbDBpnyLqOaYfXbNjYzoNxjR4tKkutIg03fV7u jZaZIEpmVqqc3Y0wgeKyelOnq/c4ZaRL+49Rhs4ZWLQkRNLZ+ECFxPnHf3m6dzDdMtyo +WBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/cHz9jXRyGP9I2nk3E8zlqOrVEHelcTSO/s6fkRs/BM=; b=CqwpAARkL/IZVJdrLLtHsdh3jdkXIzDblDBxGNvSsQVP7sHr7gNDGJ4WZYX032V0hf PZ/ZB6coWHmsE5cW/F4Hr398Tw23ErsHMACYwKksrsu35WH9poMwlrFBEFmKvIHZ2sr1 nzy5Vy5eXLCd/ECwqQknHD/85KpYkGdDebK89AXD53mfEbzrV4doLwbilU6HDZrQQZ4j 3C+9HId3xgHeh5E6F5eJj8z5zJGQcXa/nHJNebhYNZX/SKFqMAjHdy5siN7zj1l38U4d 2tVLczGvSQurcPIVYfZlZpDxD6YpExbO0lMfz5chEstPiXT3X1hc4HDHhoXSZIsTwpvk 4e+Q== X-Gm-Message-State: APjAAAXRVQPBSwNBN/4ISXhyXKq+6yvH8lmZMEum9VaHvzJkW6iyic77 AFdC8SDyzqtq3zZrVk0uXzSC0urQ X-Google-Smtp-Source: APXvYqzdqvd5xWTDdxAaCe7fjVugxxqBMGkL4fUlr6Cayn2IaWfhpgBOlfYsKE4hkf5b3TysosBuSQ== X-Received: by 2002:a17:902:968c:: with SMTP id n12mr16944966plp.144.1576865675416; Fri, 20 Dec 2019 10:14:35 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:34 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 02/15] t0000: replace test_must_fail with run_sub_test_lib_test_err() Date: Fri, 20 Dec 2019 10:15:49 -0800 Message-Id: <51a2226726c941c1229e6aafa355376fdb6c61c5.1576865664.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. We use test_must_fail to test run_sub_test_lib_test() but that function does not invoke any git commands internally. Even better, we have a function that's exactly meant to be used when we expect to have a failing test suite: run_sub_test_lib_test_err()! Replace `test_must_fail run_sub_test_lib_test` with `run_sub_test_lib_test_err`. Signed-off-by: Denton Liu --- t/t0000-basic.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 8a81a249d0..3e440c078d 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -155,7 +155,7 @@ test_expect_success 'pretend we have a fully passing test suite' " " test_expect_success 'pretend we have a partially passing test suite' " - test_must_fail run_sub_test_lib_test \ + run_sub_test_lib_test_err \ partial-pass '2/3 tests passing' <<-\\EOF && test_expect_success 'passing test #1' 'true' test_expect_success 'failing test #2' 'false' @@ -219,7 +219,7 @@ test_expect_success 'pretend we have fixed one of two known breakages (run in su " test_expect_success 'pretend we have a pass, fail, and known breakage' " - test_must_fail run_sub_test_lib_test \ + run_sub_test_lib_test_err \ mixed-results1 'mixed results #1' <<-\\EOF && test_expect_success 'passing test' 'true' test_expect_success 'failing test' 'false' @@ -238,7 +238,7 @@ test_expect_success 'pretend we have a pass, fail, and known breakage' " " test_expect_success 'pretend we have a mix of all possible results' " - test_must_fail run_sub_test_lib_test \ + run_sub_test_lib_test_err \ mixed-results2 'mixed results #2' <<-\\EOF && test_expect_success 'passing test' 'true' test_expect_success 'passing test' 'true' @@ -274,7 +274,7 @@ test_expect_success 'pretend we have a mix of all possible results' " " test_expect_success C_LOCALE_OUTPUT 'test --verbose' ' - test_must_fail run_sub_test_lib_test \ + run_sub_test_lib_test_err \ t1234-verbose "test verbose" --verbose <<-\EOF && test_expect_success "passing test" true test_expect_success "test with output" "echo foo" @@ -301,7 +301,7 @@ test_expect_success C_LOCALE_OUTPUT 'test --verbose' ' ' test_expect_success 'test --verbose-only' ' - test_must_fail run_sub_test_lib_test \ + run_sub_test_lib_test_err \ t2345-verbose-only-2 "test verbose-only=2" \ --verbose-only=2 <<-\EOF && test_expect_success "passing test" true @@ -834,7 +834,7 @@ then fi test_expect_success 'tests clean up even on failures' " - test_must_fail run_sub_test_lib_test \ + run_sub_test_lib_test_err \ failing-cleanup 'Failing tests with cleanup commands' <<-\\EOF && test_expect_success 'tests clean up even after a failure' ' touch clean-after-failure && @@ -863,7 +863,7 @@ test_expect_success 'tests clean up even on failures' " " test_expect_success 'test_atexit is run' " - test_must_fail run_sub_test_lib_test \ + run_sub_test_lib_test_err \ atexit-cleanup 'Run atexit commands' -i <<-\\EOF && test_expect_success 'tests clean up even after a failure' ' > ../../clean-atexit && From patchwork Fri Dec 20 18:15:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306091 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99385109A for ; Fri, 20 Dec 2019 18:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 789D120866 for ; Fri, 20 Dec 2019 18:14:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MrisMvnb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727443AbfLTSOi (ORCPT ); Fri, 20 Dec 2019 13:14:38 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35761 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727435AbfLTSOh (ORCPT ); Fri, 20 Dec 2019 13:14:37 -0500 Received: by mail-pf1-f193.google.com with SMTP id i23so216546pfo.2 for ; Fri, 20 Dec 2019 10:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wWeg/wl9RrK6mqFq+reQZd+RrvAMP1+PT+GY5lcwJck=; b=MrisMvnbMA6+/h6WnOvvMszYRzjd2cw7NkL28d6skpjNKhN/mFD05W9gjI2ZxCc/JH K9sld4NkcjBnjXEvrUEBrT3knlHHfPqQ+9CRThpMdF8tir63gCM1k+t6J/8jBcC2Ri81 JNx/4piinD3ufs6pk9sOE3oJ58odTtq43e8I2tHjjCSdBOJjt0HBzTzKoN0YbvNBkzzL 4IKjHfMGthRtO16a36fjBeAtZDntBBHlKO9LCkatIVuY8SmvDjScYnRJvdxnwYHa6L+2 yGtpd3nN8OSgmfNVYRtRlxaDqyHWJuAPgYKLmPqgfAf/A6cO/MMe4d1YdAHeD2KfKVWa zozw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wWeg/wl9RrK6mqFq+reQZd+RrvAMP1+PT+GY5lcwJck=; b=qqr05BqvxuIG2F2c8KvVEMwJLBmOn8TxOfMoeddw04gdP9+vSGVEg0JDxL6fm+25g1 W+ww/NlD1ngqNUNu1GjptXylGG9wrldoiDj5B6NstEK8ZEZkPz/iPBkJNZGOgOCkrZkY Nco2LA5LtiwiHHcvlrGBGWgTD8PStJDESvQBzqC1h5Zz9pbDvWfsI57OJAeFxU2MQJX2 wIwmOk2JYwgjNXx8UPW3G6zEvNb2KR8+9AVXlciGklRF7x9iFkt+ebnb3KM0Fqglo5nJ /onjhNPvVDl9KZrK0YvZPiKJBcd4TBkjMJ8o70fefVMUNF4pNy9hA63hkVYm+144XNEU zJwA== X-Gm-Message-State: APjAAAWBxv9fmiA7yiuCRDIngs9UHyB+jzczzJ4BswNUiEYHu1DP2hZo WO0NeMrmmasGdh5Sx1sTVIZgAMG2 X-Google-Smtp-Source: APXvYqz4ck+z2U10GRI1qa37crM5y3bHkEv0MQtrVr9lwDllOQXYgLuhjZz/9w3EtZtXuq/J3BdW2g== X-Received: by 2002:a62:a117:: with SMTP id b23mr17953271pff.174.1576865676347; Fri, 20 Dec 2019 10:14:36 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:35 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 03/15] t0003: use named parameters in attr_check() Date: Fri, 20 Dec 2019 10:15:50 -0800 Message-Id: <9374fcd8db831b411c1485c204cf8d029426e966.1576865664.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We had named the parameters in attr_check() but $2 was being used instead of $expect. Make all variable accesses in attr_check() use named variables instead of numbered arguments for clarity. While we're at it, add variable assignments to the &&-chain. These aren't ever expected to fail but if a future developer ever adds some code above the assignments and they could fail in some way, the intact &&-chain will ensure that the failure is caught. Signed-off-by: Denton Liu --- t/t0003-attributes.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index 71e63d8b50..3569bef75d 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -5,19 +5,16 @@ test_description=gitattributes . ./test-lib.sh attr_check () { - path="$1" expect="$2" + path="$1" expect="$2" git_opts="$3" && - git $3 check-attr test -- "$path" >actual 2>err && - echo "$path: test: $2" >expect && + git $git_opts check-attr test -- "$path" >actual 2>err && + echo "$path: test: $expect" >expect && test_cmp expect actual && test_line_count = 0 err } attr_check_quote () { - - path="$1" - quoted_path="$2" - expect="$3" + path="$1" quoted_path="$2" expect="$3" && git check-attr test -- "$path" >actual && echo "\"$quoted_path\": test: $expect" >expect && From patchwork Fri Dec 20 18:15:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306093 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47302109A for ; Fri, 20 Dec 2019 18:14:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25B2D20866 for ; Fri, 20 Dec 2019 18:14:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OFmIZp8Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727495AbfLTSOj (ORCPT ); Fri, 20 Dec 2019 13:14:39 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:37652 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727391AbfLTSOi (ORCPT ); Fri, 20 Dec 2019 13:14:38 -0500 Received: by mail-pj1-f66.google.com with SMTP id m13so4476936pjb.2 for ; Fri, 20 Dec 2019 10:14:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ISkCmzf91CTIU8RodTdihc1hjhX0gWKk58ZbMkwYFMI=; b=OFmIZp8QnzExLqq2YYUtr+ElA54mu0RYmdAsGCSCS+UilZIV66DdnE3EGvEpWfAxvF xUBRBkiR0pUS5BP1GXo9lPiC/zq+l0191JCuunlR2+XVHRJewMKShFBDSmsEAIAP7S4F w1i9svXzOzuToVVFJ5DSMYn1AVbygU01fuAzTVd4HRxi+rFbJo5XDDvJouitO303VVWU OnPpYFAKB1EI27fhhmaiAIz4yyu7/aWSwdnsJlEpqaXptbCHdqBmvGhZqSeU6Q/4UlkZ sLLQ6kdgHtnY0ZmZ2ps1ce851OyET27Nt771S5CPoVXPr+/qTnRYp1JoOmg3Uo3urPwg uDxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ISkCmzf91CTIU8RodTdihc1hjhX0gWKk58ZbMkwYFMI=; b=QxABzGCS4eFtGnRzOPj/jPL5DLx7Q9ExddhCrdWKzziTaKFH/FS4mh2OdzfH986NFy 3/emkEwbc61aKgPBRJ3BKuj2DMkubwYCuzpVu3uZKciDvEBC7ZLENbd2gcVciK/LE06i FPEtKvW1ISw3D1ST79jVDIho3DcxZ7OG7KO5FslKRydOWKFMiuHEIGTgKLmL8QQwP1C/ qXdO0Z9g+OPTYEKmN6zjCa9TPlY70aqZAT68TpiptUo0rT7cJjs4qRllVEKuVW3SR8TM nyO6hyPoOL3aCPFDzFvxojzdi/cX+HxZ39D+ohunzpdrbliWd/8wnwFeMnx7ciER04Sd 5EvQ== X-Gm-Message-State: APjAAAWyjTJlvSR0pGb0AHjsvHLHla5cXiMy+76GYXRTzIFrepy47g9b kh1Ob9bdOpU8XLEWxsLd9PObdt2s X-Google-Smtp-Source: APXvYqyjdsGv7e6zoWWG01ytOrpA7jfkg2MI68wRl0HnFwUUxEszJAHbZpVVHOnR1QdEEJp6DONs9A== X-Received: by 2002:a17:902:7484:: with SMTP id h4mr16000934pll.206.1576865677196; Fri, 20 Dec 2019 10:14:37 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:36 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 04/15] t0003: use test_must_be_empty() Date: Fri, 20 Dec 2019 10:15:51 -0800 Message-Id: <7f8808a850cd01a605794fc5b5bb276330d7abb5.1576865664.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In several places, we used `test_line_count = 0` to check for an empty file. Although this is correct, it's overkill. Use test_must_be_empty() instead because it's more suited for this purpose. Signed-off-by: Denton Liu --- t/t0003-attributes.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index 3569bef75d..c30c736d3f 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -10,7 +10,7 @@ attr_check () { git $git_opts check-attr test -- "$path" >actual 2>err && echo "$path: test: $expect" >expect && test_cmp expect actual && - test_line_count = 0 err + test_must_be_empty err } attr_check_quote () { @@ -241,7 +241,7 @@ EOF git check-attr foo -- "a/b/f" >>actual 2>>err && git check-attr foo -- "a/b/c/f" >>actual 2>>err && test_cmp expect actual && - test_line_count = 0 err + test_must_be_empty err ' test_expect_success '"**" with no slashes test' ' @@ -262,7 +262,7 @@ EOF git check-attr foo -- "a/b/f" >>actual 2>>err && git check-attr foo -- "a/b/c/f" >>actual 2>>err && test_cmp expect actual && - test_line_count = 0 err + test_must_be_empty err ' test_expect_success 'using --git-dir and --work-tree' ' From patchwork Fri Dec 20 18:15:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306097 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB5A717EF for ; Fri, 20 Dec 2019 18:14:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9DDC2146E for ; Fri, 20 Dec 2019 18:14:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P7KqUCMt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727516AbfLTSOk (ORCPT ); Fri, 20 Dec 2019 13:14:40 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45176 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727435AbfLTSOj (ORCPT ); Fri, 20 Dec 2019 13:14:39 -0500 Received: by mail-pg1-f193.google.com with SMTP id b9so5303845pgk.12 for ; Fri, 20 Dec 2019 10:14:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ttleWsc2r7j1vRbYriqwoN83seuUddyDy7i7ATQAyS8=; b=P7KqUCMtpYJ+0/q/EFkO9LxnyFjXblxyOf/2A/HrXJvHwnq9VSX02TFg99PHhDgkEF /CO/y11V/I1Q5m/D9L0/mm5rBTSU1p2pCtXiEzUM9qI8t39lcveIcz2+P4sttC/3mIJM cvPTKHrlR+gwCYPEz+xG6Je2I/6T9o/qMn5bO2sKKRfR6KtUalzGZxK6v+/cQREaNJfe MAZCbVgE+8xQtKCtVL6hrBd07caBaiZNhmFem/XAaEzkSEMvkcofrQP7aYbOOm4WL+Rq GvofQuDG2+X1GsX4dR9jBFOL4x91sO9u7NJwCDyHoUbE0cDWQzwkprQxNWRn7HLqB3DJ 1bkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ttleWsc2r7j1vRbYriqwoN83seuUddyDy7i7ATQAyS8=; b=C266zf2QlKpBTYJ2QTVWKxQV+Gy/aTo9O6Re+mWuLJW7zIfSDCSHlaqspZkzU0+bah 9VZOCi24Sf8yYieLf1KXPU7wBAXFNKp/0MPIPrlO5nKbBHFP+xv7ux276lm4NPDjOL8k ucGEplx+hPgz2W1qdpYfCWY21A8EAmz/cHp8+rIIIPraJWXz17k1DEDeqlqnkwEgxhlJ ZMuZA7G4q4xYSagrFTbJCOhRnJjAtQdWAD7Mi+d0g/GtN8krjXajh11/89P+IosC3XSZ 2fYShirjCN55Zh7rt8kcnlqO2lcDEWtHwVxkn2WeRuc/oI8wFASyWoBuMquG7b3s7fDb H1YA== X-Gm-Message-State: APjAAAULUKLVmAEQYp6ZhQsY/8+VTebMlTacau6J0QGUDxMjKmyNT1Rk x5cLObgA/rUUYVetZXLjqueVV3O3 X-Google-Smtp-Source: APXvYqx3uymzA/M3Eu4KWdrhSRMFIae3igi2xmK4liTQgHjOnqKbuI06TA5ZwCRA499VPYgHucwcTw== X-Received: by 2002:a63:c20c:: with SMTP id b12mr15882186pgd.407.1576865678355; Fri, 20 Dec 2019 10:14:38 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:37 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 05/15] t0003: don't use `test_must_fail attr_check` Date: Fri, 20 Dec 2019 10:15:52 -0800 Message-Id: X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In an effort to remove test_must_fail for all invocations not related to git or test-tool, replace invocations of `test_must_fail attr_check` with a plain attr_check call with the $expect argument set to the actual value output by git. Signed-off-by: Denton Liu --- t/t0003-attributes.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index c30c736d3f..b660593c20 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -24,7 +24,7 @@ attr_check_quote () { test_expect_success 'open-quoted pathname' ' echo "\"a test=a" >.gitattributes && - test_must_fail attr_check a a + attr_check a unspecified ' @@ -109,20 +109,20 @@ test_expect_success 'attribute test' ' test_expect_success 'attribute matching is case sensitive when core.ignorecase=0' ' - test_must_fail attr_check F f "-c core.ignorecase=0" && - test_must_fail attr_check a/F f "-c core.ignorecase=0" && - test_must_fail attr_check a/c/F f "-c core.ignorecase=0" && - test_must_fail attr_check a/G a/g "-c core.ignorecase=0" && - test_must_fail attr_check a/B/g a/b/g "-c core.ignorecase=0" && - test_must_fail attr_check a/b/G a/b/g "-c core.ignorecase=0" && - test_must_fail attr_check a/b/H a/b/h "-c core.ignorecase=0" && - test_must_fail attr_check a/b/D/g "a/b/d/*" "-c core.ignorecase=0" && - test_must_fail attr_check oNoFf unset "-c core.ignorecase=0" && - test_must_fail attr_check oFfOn set "-c core.ignorecase=0" && + attr_check F unspecified "-c core.ignorecase=0" && + attr_check a/F unspecified "-c core.ignorecase=0" && + attr_check a/c/F unspecified "-c core.ignorecase=0" && + attr_check a/G unspecified "-c core.ignorecase=0" && + attr_check a/B/g a/g "-c core.ignorecase=0" && + attr_check a/b/G unspecified "-c core.ignorecase=0" && + attr_check a/b/H unspecified "-c core.ignorecase=0" && + attr_check a/b/D/g a/g "-c core.ignorecase=0" && + attr_check oNoFf unspecified "-c core.ignorecase=0" && + attr_check oFfOn unspecified "-c core.ignorecase=0" && attr_check NO unspecified "-c core.ignorecase=0" && - test_must_fail attr_check a/b/D/NO "a/b/d/*" "-c core.ignorecase=0" && + attr_check a/b/D/NO unspecified "-c core.ignorecase=0" && attr_check a/b/d/YES a/b/d/* "-c core.ignorecase=0" && - test_must_fail attr_check a/E/f "A/e/F" "-c core.ignorecase=0" + attr_check a/E/f f "-c core.ignorecase=0" ' @@ -146,8 +146,8 @@ test_expect_success 'attribute matching is case insensitive when core.ignorecase ' test_expect_success CASE_INSENSITIVE_FS 'additional case insensitivity tests' ' - test_must_fail attr_check a/B/D/g "a/b/d/*" "-c core.ignorecase=0" && - test_must_fail attr_check A/B/D/NO "a/b/d/*" "-c core.ignorecase=0" && + attr_check a/B/D/g a/g "-c core.ignorecase=0" && + attr_check A/B/D/NO unspecified "-c core.ignorecase=0" && attr_check A/b/h a/b/h "-c core.ignorecase=1" && attr_check a/B/D/g "a/b/d/*" "-c core.ignorecase=1" && attr_check A/B/D/NO "a/b/d/*" "-c core.ignorecase=1" From patchwork Fri Dec 20 18:15:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306095 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6856C109A for ; Fri, 20 Dec 2019 18:14:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47DE220866 for ; Fri, 20 Dec 2019 18:14:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZiIPJFwt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727519AbfLTSOl (ORCPT ); Fri, 20 Dec 2019 13:14:41 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43948 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727506AbfLTSOk (ORCPT ); Fri, 20 Dec 2019 13:14:40 -0500 Received: by mail-pf1-f193.google.com with SMTP id x6so4542055pfo.10 for ; Fri, 20 Dec 2019 10:14:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gk5ZJhKfpe1whOMTpaFphgIH3CNUsLpTz28Dli3F+m4=; b=ZiIPJFwt9L5HpMJaSMszdUTXGQmQTcjCBrmNw0vcGSXO6nBzu1oAfsyyfc2w0WoQO4 WGovijp90FvPfgnmtlz6FDe1GeBAZH0aKyjoO01I/YdCZa71JirAWQ7j3xF0eEGbSq7u tUq91WPkZdGWwmhQcnqBhyOV7vmTw4aA153Xn+4SVXrQHl8PeU1tWglwc/+E+AaGFklv L3TkGPDI9rFgsrxKteUMHtbFcIGzkt4XkefTYQX/+jzwsJGVfi6B4A8BaifT0Q0LwUKU VxogM2ZZhu6cleD2HbdPP/02goo2O4XTkHSSisG/qxM9a+AGHi7vdgAxFFpshikUYwJK Xd5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gk5ZJhKfpe1whOMTpaFphgIH3CNUsLpTz28Dli3F+m4=; b=MjNz6YaJmDeT30Ku+enq/lqMi2pZ1vfeP7+6NPFaSQCii3Ev6/Xi8rlDuDej2jJRF0 mKltxX+6fnpKensrrlYmgsIZSiE7pWjOUyCMNM+t+KdL3s5uB7P/vFJbtkO1nAZF7u8D 2eaVe/wQjnOyrcodC4qZ8ny2ZOaRXyzxRxRR+OeK6voqIc0SBpwtaYiGGqkk0VpxeYco eHZhDk9LlQkkaYYhNx6Ty1pUOcCEkP0UK8eyi0p0WENKjbn5mK99W2bg97NAOpgU7HHk 5nB7FwFgcXuAdvYuQ2W+KjA/Djo1sh0DTDcavHGpZweUHjIpvVgtZw4p76cW+rVFdqZg mHvA== X-Gm-Message-State: APjAAAURiHLHciPy1ZRch0c061L1I29sn2KO8Bsxp4qOO+T//NqtmUvE rSng6RfGIAih1F0JLdXDDTMh7NRO X-Google-Smtp-Source: APXvYqydNcyV/Rvvl6DcmiJaIJRVkGP6A1/9Q1b4Loa9jW5NOlSkYEdpC5WjNij80ydMp+P+ZD80DA== X-Received: by 2002:a63:a4b:: with SMTP id z11mr15640628pgk.97.1576865679167; Fri, 20 Dec 2019 10:14:39 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:38 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 06/15] t0020: don't use `test_must_fail has_cr` Date: Fri, 20 Dec 2019 10:15:53 -0800 Message-Id: X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. Since has_cr() just wraps a tr and grep pipeline, replace `test_must_fail has_cr` with `! has_cr`. Signed-off-by: Denton Liu --- t/t0020-crlf.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh index 854da0ae16..b63ba62e5d 100755 --- a/t/t0020-crlf.sh +++ b/t/t0020-crlf.sh @@ -159,8 +159,8 @@ test_expect_success 'checkout with autocrlf=input' ' rm -f tmp one dir/two three && git config core.autocrlf input && git read-tree --reset -u HEAD && - test_must_fail has_cr one && - test_must_fail has_cr dir/two && + ! has_cr one && + ! has_cr dir/two && git update-index -- one dir/two && test "$one" = $(git hash-object --stdin .gitattributes && git read-tree --reset -u HEAD && - test_must_fail has_cr dir/two + ! has_cr dir/two ' test_expect_success '.gitattributes says two and three are text' ' @@ -270,7 +270,7 @@ test_expect_success 'in-tree .gitattributes (1)' ' rm -rf tmp one dir .gitattributes patch.file three && git read-tree --reset -u HEAD && - test_must_fail has_cr one && + ! has_cr one && verbose has_cr three ' @@ -280,7 +280,7 @@ test_expect_success 'in-tree .gitattributes (2)' ' git read-tree --reset HEAD && git checkout-index -f -q -u -a && - test_must_fail has_cr one && + ! has_cr one && verbose has_cr three ' @@ -291,7 +291,7 @@ test_expect_success 'in-tree .gitattributes (3)' ' git checkout-index -u .gitattributes && git checkout-index -u one dir/two three && - test_must_fail has_cr one && + ! has_cr one && verbose has_cr three ' @@ -302,7 +302,7 @@ test_expect_success 'in-tree .gitattributes (4)' ' git checkout-index -u one dir/two three && git checkout-index -u .gitattributes && - test_must_fail has_cr one && + ! has_cr one && verbose has_cr three ' From patchwork Fri Dec 20 18:15:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306101 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 61CD6109A for ; Fri, 20 Dec 2019 18:14:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3CBF62146E for ; Fri, 20 Dec 2019 18:14:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eiocWMPX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727532AbfLTSOo (ORCPT ); Fri, 20 Dec 2019 13:14:44 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36167 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727513AbfLTSOk (ORCPT ); Fri, 20 Dec 2019 13:14:40 -0500 Received: by mail-pf1-f195.google.com with SMTP id x184so5645502pfb.3 for ; Fri, 20 Dec 2019 10:14:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JALWx8kavwlDW5GZC+ZEtTUpTnn8GUR/cS+EbnJCO8w=; b=eiocWMPXeHWPDzprHw1ARxeRWobjv6eB2H6hZHNiphC/Urlz7sRkNEWjDvhZpykIG/ Zt6/j0hCdA89JVBDYD37NijQQ8BA8XggwO+S5Kkp1YQtCduXhtHWsVakStLkA/tynhkH bmyAYBlqcuO8dusc6lu0SXEVu8+A45kwsciC/kIrlp8JSrngzv3Os8RtaIFRdp7HrhWL xOTjPj5FzM919+wPL9SkO6pGwpUIsdurb7NRAFtGq3YYdT5f+CuSdLWECsC8T+u1G3e9 HQlrZAM0JK9EjKiqACWXMJdAjeEyWCQK/haX1GiqTSyl33D4T5jIlorjEU1YLVbMhJpI yVKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JALWx8kavwlDW5GZC+ZEtTUpTnn8GUR/cS+EbnJCO8w=; b=DXQsM6KJKC20jLcOGOirNjGMH0rtLkqLxlw8zS7uRlWBLZnsa2qt76khMPK928YBcj JAiB4xTvV5y5jpfMxS8pprE8uWniBGJzEAb85Fi5o46l9afe1+TzoparP1lpgMYZq4wN 6DW69ZMHucROGV1sAX7ATwTewUpL335LLh+11qs8xxHICR4pB+nALS/p9NXQlG9pE+uR y54OCsc6weZffZffUuxOjb3hapqJ00cf9knHtH40HY1sBQUyW0+moWnYlIS1Dbiz/+9y scTUQ+YbBUObEaSpImoV1vBll9j63eAFT41PZkxK3+WZaj+h4ZYv4AfwJF2dIbP6mjE1 vR6A== X-Gm-Message-State: APjAAAWJ1gvt7jUfkmb+z4dAAQFA0kI4HyntpAR0ZuzUcH0JHLpLhYYF HxFBjVckdVaMkaLWnxn+CrvdUrxF X-Google-Smtp-Source: APXvYqxQhnbPe03AevbEtL771P9BedjmzR1AZpOmWGzJYH3J8yhJxLLUoDKgzCvjDBTxfb0R+77Odw== X-Received: by 2002:a62:fc93:: with SMTP id e141mr17067597pfh.262.1576865680230; Fri, 20 Dec 2019 10:14:40 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:39 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 07/15] t0020: use ! check_packed_refs_marked Date: Fri, 20 Dec 2019 10:15:54 -0800 Message-Id: X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail function should only be used for git commands since we should assume that external commands work sanely. Since check_packed_refs_marked() just wraps a grep invocation, replace `test_must_fail check_packed_refs_marked` with `! check_packed_refs_marked`. Signed-off-by: Denton Liu --- t/t1409-avoid-packing-refs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t1409-avoid-packing-refs.sh b/t/t1409-avoid-packing-refs.sh index e5cb8a252d..c46848eb8e 100755 --- a/t/t1409-avoid-packing-refs.sh +++ b/t/t1409-avoid-packing-refs.sh @@ -46,7 +46,7 @@ test_expect_success 'check that marking the packed-refs file works' ' git for-each-ref >actual && test_cmp expected actual && git pack-refs --all && - test_must_fail check_packed_refs_marked && + ! check_packed_refs_marked && git for-each-ref >actual2 && test_cmp expected actual2 ' @@ -80,7 +80,7 @@ test_expect_success 'touch packed-refs on delete of packed' ' git pack-refs --all && mark_packed_refs && git update-ref -d refs/heads/packed-delete && - test_must_fail check_packed_refs_marked + ! check_packed_refs_marked ' test_expect_success 'leave packed-refs untouched on update of loose' ' From patchwork Fri Dec 20 18:15:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306099 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23741109A for ; Fri, 20 Dec 2019 18:14:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 019AF2082E for ; Fri, 20 Dec 2019 18:14:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ebl2tiRm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727526AbfLTSOn (ORCPT ); Fri, 20 Dec 2019 13:14:43 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:32925 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727506AbfLTSOm (ORCPT ); Fri, 20 Dec 2019 13:14:42 -0500 Received: by mail-pj1-f68.google.com with SMTP id u63so4156586pjb.0 for ; Fri, 20 Dec 2019 10:14:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x2mUy2uXMcc2KMq6HG3rtk0SZXxq/MwIutBy33gHbX0=; b=Ebl2tiRmjGEjs4YoPdjAIsnPY6VLCTWS+h0OHMueBBtGN7mIBW9BeHWM1v1KxVPdt7 RaYUYAvuhrs7EFuO1Z6R4wxFQV7HKmHPmRzYPJOGg4aGwcZ4BtBDUXY2LI1KjW6PG8W7 b2VOK2behto0BfG+7Z2SKIYjmPF6KaaXOzB8f1a69ewultBTBXIHO5F9qsX0CyVM0YuA QaC8wt2XWO2VDy20lrS86FvIHEm3d7mZnkc+vOseaWqVr5hLtsnvdT9f3LnhWafYTdGc nc0NL2tmNlj9cDwRzrDB/2sE52tNZ+zHjcBs2tftzF34H3IGUer0ktPe24ziAOY4vAkL aZdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x2mUy2uXMcc2KMq6HG3rtk0SZXxq/MwIutBy33gHbX0=; b=dxWE0aF9GZL3ubPJyP8jTQvlVomWaEBrroG5QI+nDiuuLsxTeh/loCbZGq/k+D7xUB keIyIK3HCLR6jVIomYKBxOdEST3NnFkpeqqmX47WPHHooaGJDlElUQcvFz+ctuZHrvNB PDfqDIkBIxBGrBgRFoBTxIMvUffVRR66aXGq/EoYaqwryLVhaBWGqZtQ+6d0Ch+i2++B e9W1XWNxucdbq08pzWiUVmdpuAwDOVxKKpFgxcqLvNi09njt/ong5zgPFiVmp+R5zTGn Lpnp8dkfjvvyxmzDokmu8+kK01rRVIxvfDI7h/xE0+D/aR96ornRksO0sPet4+pmb4nf ZEeA== X-Gm-Message-State: APjAAAWJcK1aUC3sn+tJ8EVtPWCTtUD8mCSZaiQ8xOXqgrvFzNi5mL79 Q4J+KChix/TfIGGTRh69xMmhtDHg X-Google-Smtp-Source: APXvYqwoI89BBZpX8AWKA1ZXIwP9wG+D3XJ7WCXY5ImW1LZXNYDY8lxIu6wkGbkXGdQ/3O6JRIisLQ== X-Received: by 2002:a17:902:9a98:: with SMTP id w24mr16589824plp.300.1576865680936; Fri, 20 Dec 2019 10:14:40 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:40 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 08/15] t1306: convert `test_might_fail rm` to `rm -f` Date: Fri, 20 Dec 2019 10:15:55 -0800 Message-Id: <7e29b0154ef71a0a5743f9a2b281b40ba3337a07.1576865664.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail() family of functions (including test_might_fail()) should only be used on git commands. Replace `test_might_fail rm` with `rm -f` so that we don't use `test_might_fail` on a non-git command. Signed-off-by: Denton Liu --- t/t1306-xdg-files.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh index 21e139a313..dd87b43be1 100755 --- a/t/t1306-xdg-files.sh +++ b/t/t1306-xdg-files.sh @@ -153,7 +153,7 @@ test_expect_success 'Checking attributes in both XDG and local attributes files' test_expect_success 'Checking attributes in a non-XDG global attributes file' ' - test_might_fail rm .gitattributes && + rm -f .gitattributes && echo "f attr_f=test" >"$HOME"/my_gitattributes && git config core.attributesfile "$HOME"/my_gitattributes && echo "f: attr_f: test" >expected && @@ -165,7 +165,7 @@ test_expect_success 'Checking attributes in a non-XDG global attributes file' ' test_expect_success 'write: xdg file exists and ~/.gitconfig doesn'\''t' ' mkdir -p "$HOME"/.config/git && >"$HOME"/.config/git/config && - test_might_fail rm "$HOME"/.gitconfig && + rm -f "$HOME"/.gitconfig && git config --global user.name "write_config" && echo "[user]" >expected && echo " name = write_config" >>expected && @@ -183,8 +183,8 @@ test_expect_success 'write: xdg file exists and ~/.gitconfig exists' ' test_expect_success 'write: ~/.config/git/ exists and config file doesn'\''t' ' - test_might_fail rm "$HOME"/.gitconfig && - test_might_fail rm "$HOME"/.config/git/config && + rm -f "$HOME"/.gitconfig && + rm -f "$HOME"/.config/git/config && git config --global user.name "write_gitconfig" && echo "[user]" >expected && echo " name = write_gitconfig" >>expected && From patchwork Fri Dec 20 18:15:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306111 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45E4713A4 for ; Fri, 20 Dec 2019 18:14:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2488B20866 for ; Fri, 20 Dec 2019 18:14:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O31spNxx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727538AbfLTSOq (ORCPT ); Fri, 20 Dec 2019 13:14:46 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:37981 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727523AbfLTSOn (ORCPT ); Fri, 20 Dec 2019 13:14:43 -0500 Received: by mail-pj1-f68.google.com with SMTP id l35so4476066pje.3 for ; Fri, 20 Dec 2019 10:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cq3i6CU2w1OvkLOnIHEPmtZ2dO3HE+MsuoDzwGrRs/Q=; b=O31spNxxn7VQnEvwhSPthNMjvnj/eNVhK/PyoayF8qySczuOptBChGpQbA6+2uXt1w peo0gD3j4Jp9gbvVF2SDbUTeRM63vt7bSA3i7pE3afAQ366jXO+sOoB8GhZ/REL7xgOc 3YPGAsxQ+pdL4DNkphWwJFK0M9lfdz0Pm7vSgb1ss21CA1iWwf5BhXcras3SBo1l1UwY zjJYF6CYC8dh1WB3t4Zs3uf41QrGX67PIXUTWsg7npPdhx+RayIPQeIbYZ/1CjP+bLfv MtuwhFp5UfmTWO3zcwfpLmgq1l9YQi+rLMvFPbmeuMV5PzskaDs8JLPCO4H+XNcQBru3 ytiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cq3i6CU2w1OvkLOnIHEPmtZ2dO3HE+MsuoDzwGrRs/Q=; b=QHbMqmzJbixzL3TTM5BOu4RK9B3qKoQoXeN2WJ6Ke5oH4Zswajdzc0pTrW9k8mqgho mMkKPTJ/dVGo+HT00W/viX0C2jMmq8v3aTTxqV4ugasVC0WHqth2XX39Xqk5TgLft3ji KtY/z62nob6r8WdN+QWs29IOhyZPQuHBOvxeNBAHHinepP+VytMPdfPXXMCtvYJKzRd1 Z6aK58UoQ0H9v3fcfodXjmSHoK4Q6Jj4fp2jmjAiYxwGXwJ4Y5f7V/plgAFXeC+nhm96 gDIOhrp3atNpQifeYYww7gpR8iSxgyK638PvmInpqMD1Ls7iurotXHNDWKVitN+5qSxy gm6g== X-Gm-Message-State: APjAAAVxXo0H/jpSNI2rG8+RMGDaEwMOqvp7BjYmR2bj/XDxd3IaGxh/ xfc3Y1Z3SpFCZeJE0dBNdlN1OD23 X-Google-Smtp-Source: APXvYqwOHymacV08h6x7NwRWTiW3GxdU3sc9hkBg33hdI9deafbigBRqxlw6YxutJNhBQrg06KKc9w== X-Received: by 2002:a17:902:7787:: with SMTP id o7mr17089054pll.328.1576865682025; Fri, 20 Dec 2019 10:14:42 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:41 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 09/15] t1307: reorder `nongit test_must_fail` Date: Fri, 20 Dec 2019 10:15:56 -0800 Message-Id: X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In the future, we plan on only allowing `test_must_fail` to work on a restricted subset of commands, including `git`. Reorder the commands so that `nongit` comes before `test_must_fail`. This way, `test_must_fail` operates on a git command. Signed-off-by: Denton Liu --- t/t1307-config-blob.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh index 37dc689d8c..002e6d3388 100755 --- a/t/t1307-config-blob.sh +++ b/t/t1307-config-blob.sh @@ -74,7 +74,7 @@ test_expect_success 'can parse blob ending with CR' ' ' test_expect_success 'config --blob outside of a repository is an error' ' - test_must_fail nongit git config --blob=foo --list + nongit test_must_fail git config --blob=foo --list ' test_done From patchwork Fri Dec 20 18:15:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306105 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4D4D13A4 for ; Fri, 20 Dec 2019 18:14:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3E622146E for ; Fri, 20 Dec 2019 18:14:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KEsNpkTg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727548AbfLTSOr (ORCPT ); Fri, 20 Dec 2019 13:14:47 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41607 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbfLTSOn (ORCPT ); Fri, 20 Dec 2019 13:14:43 -0500 Received: by mail-pf1-f195.google.com with SMTP id w62so5624944pfw.8 for ; Fri, 20 Dec 2019 10:14:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p2ArS+YljEb7t4oUKI+NSVa4SXdQS2+gUCxgbp6aCbE=; b=KEsNpkTgifh4tvM8wkp4etAZoBlKRDAgbIOk4+1avclblflOfGmNaz0klEJFa0dXXr /AO/ZWJhaCr8OuHAMbUiQIVYOReN1vO2gAT8q3oH2lwLygLma2MeitYuMjyFxZ+ZpFJq Lyklm6fF1Mfri/74Saa4ggiU/M9Qt/cMfyLB4q4v/3J+o6xD6leQgIL2Rcl7d17vSY6o Ge1qcPj7O07OdoIX8uHrG8B2ZAlvtT9jASUE9OQ/bEFevDTNu4WI6ZyFVezTzLWSwmX9 xdro6Rr2Dsiz389Chmyiz56RK5PPpBHStpQka2D4pVOwAM7lnyNms4fZNrp4BDlubBmz KesA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p2ArS+YljEb7t4oUKI+NSVa4SXdQS2+gUCxgbp6aCbE=; b=iSxQkoX5RqpHTnfX2+vK3d9XzrN0eetzvWJ7+ahDvecsrRabtrR6ghlvnGDllbl7yq 4kNBTash8iKhv59izUqiqPwQRsFrS2mZjOarAKPkqrYIRcd7S67Z9xw9Ts6mDsLa78Gn IvhxgBFmUgLCF2eeP91xF6Natwp+lune+LwgQBKVg84UZpJhpwok0TjC5ee7rBOhOi8n hKhNs/syv6htxax/vB2c7PfkglFlSJXjbES2TLjc/OpWfgfF+VaYFKpxRigNf12G4ZtZ uF34A52Ci7q7J+f/xogzr8AgtmXDYgLWFl50MDjCwCd/Gc4apf2SaVO9RF/KqU1FR/ze f4kQ== X-Gm-Message-State: APjAAAUlm4FiDGujqPSY2AZcVUQc2w3yqQB6yZyCDXAoHrNJ/95qMZ8A hcYOVgrPf09ApZpdDFS0wmEpnUrS X-Google-Smtp-Source: APXvYqxH4oXHosAO4wCjIlX+hNdeku/s9j/sm1GuvelTZY2Kn1itnaPM4GELWBKWYy04l5/iwRPBAg== X-Received: by 2002:a62:8f8f:: with SMTP id n137mr4469540pfd.82.1576865682864; Fri, 20 Dec 2019 10:14:42 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:42 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 10/15] t1409: let sed open its own input file Date: Fri, 20 Dec 2019 10:15:57 -0800 Message-Id: X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In one case, we were using a redirection operator to feed input into sed. However, since sed is capable of opening its own input file, make sed do that instead of redirecting input into it. Signed-off-by: Denton Liu --- t/t1409-avoid-packing-refs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1409-avoid-packing-refs.sh b/t/t1409-avoid-packing-refs.sh index c46848eb8e..f74d890e82 100755 --- a/t/t1409-avoid-packing-refs.sh +++ b/t/t1409-avoid-packing-refs.sh @@ -8,7 +8,7 @@ test_description='avoid rewriting packed-refs unnecessarily' # shouldn't upset readers, and it should be omitted if the file is # ever rewritten. mark_packed_refs () { - sed -e "s/^\(#.*\)/\1 t1409 /" <.git/packed-refs >.git/packed-refs.new && + sed -e "s/^\(#.*\)/\1 t1409 /" .git/packed-refs >.git/packed-refs.new && mv .git/packed-refs.new .git/packed-refs } From patchwork Fri Dec 20 18:15:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306103 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED628109A for ; Fri, 20 Dec 2019 18:14:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBBC820866 for ; Fri, 20 Dec 2019 18:14:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nFYTvOwZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727545AbfLTSOr (ORCPT ); Fri, 20 Dec 2019 13:14:47 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:39425 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727531AbfLTSOo (ORCPT ); Fri, 20 Dec 2019 13:14:44 -0500 Received: by mail-pj1-f66.google.com with SMTP id t101so4470242pjb.4 for ; Fri, 20 Dec 2019 10:14:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iMKCNtVrFuUR6GRfj2YvDoumjSCaOdhEwxsJVghCcZk=; b=nFYTvOwZI5fvLiAsRfjya4QAyXRApa0nrdyIFLAOWI4XNzLmGY4nptz+6Y8gWivXn4 stGW9VckdmeUTiZUjsqZNbZqjvOdYxtKOaSaAs2y+DzliZn4bi7n90sj8Y4OrPLCKwc+ mVKtgQ1+WBTIXOgCtVYS399HWzwL6KWw+XijxZT8SYXaQHvdFQVVogVcbCAX6FcQVSuZ O6EFBhuf0TDDLujS25O1hdnh4zQCyNcx/naOlVXTz5um7Lf7MNt9xIS45C/FQhiMe/65 iEn6zjMd9ZGHDiShWhZWw+6Lzw9RRRWbTj5rb1g31h304W7b8lPNeHYpaFoeGywmaYin Rg7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iMKCNtVrFuUR6GRfj2YvDoumjSCaOdhEwxsJVghCcZk=; b=CUpz1ixuenERCTF/FmrZSbHrWfEscjv4bIrbvQW1aeLuT9tE+9V/yIPx44owwcdIGz tyEF59Ryh9gRbt6SXe+jbPdcS9LUnFtVAaQt2OXgyyxY7Tf8cZYAvNVZjJr6RGxWpNPr IruhcxXSPyCF0z0yYX5hKB2XtbAD3EduUe7zaLo6H2Ds5TdNQSaCGy4HZbVV19VjO5WL NDxwHZQupPuoN2mOhFI2M8GD/uGtiTiX5m+OiPr0GNaImceyLJl4OMxqbHdiKZE6TY/z M5ck7MP7RB0YOKGqTtsqAB2lPTdIuxKjMo5F7bvl5aO0rMsOIxU+fjNg+F5hsO1LYz0R TbLQ== X-Gm-Message-State: APjAAAX9xO+UcOFQ3z6iSBdbvkOc9tgbO/1Xmmr6VQ1B3h7CmOJiC8bN Il8JucCDKGNXF5p3MiSE8IR84BN5 X-Google-Smtp-Source: APXvYqxf5wwRMz6HmgojlSgsMICAC8ZVDnL0vkwCXTOonLqJP9kq74P4LbNidUmVTkNbH8c7Bos5Sw== X-Received: by 2002:a17:902:d915:: with SMTP id c21mr16552279plz.295.1576865683589; Fri, 20 Dec 2019 10:14:43 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:43 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 11/15] t1409: use test_path_is_missing() Date: Fri, 20 Dec 2019 10:15:58 -0800 Message-Id: <1eef3f4bc5f93b8a0a6ce8b26a208cba4f06a56c.1576865664.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail() function should only be used for git commands since we should assume that external commands work sanely. Replace `test_must_fail test -f` with `test_path_is_missing` since we expect these paths to not exist. Signed-off-by: Denton Liu --- t/t1409-avoid-packing-refs.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t1409-avoid-packing-refs.sh b/t/t1409-avoid-packing-refs.sh index f74d890e82..be12fb6350 100755 --- a/t/t1409-avoid-packing-refs.sh +++ b/t/t1409-avoid-packing-refs.sh @@ -27,15 +27,15 @@ test_expect_success 'setup' ' ' test_expect_success 'do not create packed-refs file gratuitously' ' - test_must_fail test -f .git/packed-refs && + test_path_is_missing .git/packed-refs && git update-ref refs/heads/foo $A && - test_must_fail test -f .git/packed-refs && + test_path_is_missing .git/packed-refs && git update-ref refs/heads/foo $B && - test_must_fail test -f .git/packed-refs && + test_path_is_missing .git/packed-refs && git update-ref refs/heads/foo $C $B && - test_must_fail test -f .git/packed-refs && + test_path_is_missing .git/packed-refs && git update-ref -d refs/heads/foo && - test_must_fail test -f .git/packed-refs + test_path_is_missing .git/packed-refs ' test_expect_success 'check that marking the packed-refs file works' ' From patchwork Fri Dec 20 18:15:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306107 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D76DF13A4 for ; Fri, 20 Dec 2019 18:14:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B68F52146E for ; Fri, 20 Dec 2019 18:14:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fR8e8x/i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727551AbfLTSOs (ORCPT ); Fri, 20 Dec 2019 13:14:48 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:35577 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727513AbfLTSOp (ORCPT ); Fri, 20 Dec 2019 13:14:45 -0500 Received: by mail-pl1-f194.google.com with SMTP id g6so4437440plt.2 for ; Fri, 20 Dec 2019 10:14:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kc3R5dRmMVYqjFAiyQAts3Ju9CV9qoOxk1oAWYwbw3c=; b=fR8e8x/iushdVobNfwZ7ZBVo1vWfMFlA5/bu0B5pEe9JHRehopVkYDCLcBBGsO/0Dq FKjGNgxL4YobJduh9kF7XqqzO5poVMfGRDrZhdeq1H4MaVZm9xmbFqJzmKGtDUtnKgvL J5YLphXPsOvxIAruT8hvUQI9FZVTIPY30pXaXrbb039kzoEHJT0BWgV1wwKbX4ZMT0II fxd4JEhYvHEF/TL0qzcTOeHRiJGzzUbE+j2U7xD3wbOyYh9girkWJ6urDUFiXk8t7hqL j07QPkYKnXi9IbPPUXDfSVv88HLv+2eS2K4j1Nkkag97ykGIBHyHRBf3RoaJYDUH4tNa r+QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kc3R5dRmMVYqjFAiyQAts3Ju9CV9qoOxk1oAWYwbw3c=; b=Ic8UGkJw+To46JgGHF0QCvBSc7q2WvMAijPJG3KhFz5JfyO/1i+73QMn3cWtnfrM3F YQ15qioaSvLU/mSKsCl/hnEm6nUMUD+ZTFmkKvvIFQIK/kA/WzEOWYsn8TU1Zyf0S1Dh HbL96b/wNiSV+rR+WWI+cStRimpO5LNG4+FQPdtrb4QVkcZnOZRN1noESIh/D4wRm1gD Ka5H6zpi83W/M7GVlYXI2UCxous2LdafhVS2nrEa1+fH6C1PyI88yPb6HdmOKGAKcWzM m+2pZxdJM3JOaHdbXSaQDlskkvpDiIGmnhKbzqk7+w08ROpV2mYDvI620Fi9K/TzPeGr LCJw== X-Gm-Message-State: APjAAAVN/Ofpcbl1VeQ4hcKtXP3y2nyjnd06M9GdTJvuSQsGej8pFZQW nns/gx7jRmXPljIJh5vB2RqXIy3Z X-Google-Smtp-Source: APXvYqyGppinx82WIqeenteLccf4FWyMVftU5ggCzxfFga5KOK3m0qTI/A1oy85PYfBAFWMJEZxf1g== X-Received: by 2002:a17:902:67:: with SMTP id 94mr16934336pla.241.1576865684414; Fri, 20 Dec 2019 10:14:44 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:44 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 12/15] t1501: remove use of `test_might_fail cp` Date: Fri, 20 Dec 2019 10:15:59 -0800 Message-Id: X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test_must_fail() family of functions (including test_might_fail()) should only be used on git commands. Replace test_might_fail() with a compound command wrapping the old cp invocation that always returns 0. The `test_might_fail cp` line was introduced in 466e8d5d66 (t1501: fix test with split index, 2015-03-24). It is necessary because there might exist some index files in `repo.git/sharedindex.*` and, if they exist, we want to copy them over. However, if they don't exist, we don't want to error out because we expect that possibility. As a result, we want to keep the "might fail" semantics so we always return 0, even if the underlying cp errors out. Signed-off-by: Denton Liu --- t/t1501-work-tree.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh index 3498d3d55e..b75558040f 100755 --- a/t/t1501-work-tree.sh +++ b/t/t1501-work-tree.sh @@ -350,7 +350,7 @@ test_expect_success 'Multi-worktree setup' ' mkdir work && mkdir -p repo.git/repos/foo && cp repo.git/HEAD repo.git/index repo.git/repos/foo && - test_might_fail cp repo.git/sharedindex.* repo.git/repos/foo && + { cp repo.git/sharedindex.* repo.git/repos/foo || :; } && sane_unset GIT_DIR GIT_CONFIG GIT_WORK_TREE ' From patchwork Fri Dec 20 18:16:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306109 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41434109A for ; Fri, 20 Dec 2019 18:14:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 200B920866 for ; Fri, 20 Dec 2019 18:14:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q/RuCGn9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727553AbfLTSOt (ORCPT ); Fri, 20 Dec 2019 13:14:49 -0500 Received: from mail-pl1-f181.google.com ([209.85.214.181]:46294 "EHLO mail-pl1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727533AbfLTSOq (ORCPT ); Fri, 20 Dec 2019 13:14:46 -0500 Received: by mail-pl1-f181.google.com with SMTP id y8so4415120pll.13 for ; Fri, 20 Dec 2019 10:14:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SeZOY/KKpQY2td5afYkTiUUHcs8wX+Qr20utB7VGqmc=; b=Q/RuCGn9AdkLJ9igOBaju/3tPoqphtqJZ2sx5z1hLaLSI0PFobPlltM9L5/nhi9/3b LitIzhOunRRMjCY+gtGwvRVTFzQYPQMQqi6wMhpwg/L6cwDcvuMRLpaOcovU8B6q+MZg d1OgwH4nQ9chdlYZaOVIxq2Ay4epzXofX0Ip9dnX1oeQktQ6E7Bq8nTuGScCz6S6zpyo DG5MjGZk4H1oYWqRq7heZBWgKhLWV/WKNrhFOWCQ/YDnioToBeCJCqetoPpTc8JNT/iL WBckzOwh6y1/Xs1Ij/03Dm0Iw9zAW0yzlsq+289m9SVClLyFB5qIlp7qLwbO095zn9WY SH0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SeZOY/KKpQY2td5afYkTiUUHcs8wX+Qr20utB7VGqmc=; b=MgNraSjsnCH4pr0fz7RyVV+gd/M0gxNY1TqTCF9jkPBJ9GGbCd8Yiuw4AyzqyRtaX7 /aiQnfC/lwPl4hTH4MP4HDWkhTaKVIy7CYds9xk10PAO+UrdKuGkjvYlWM0Vbrg2e0ug xZv/XE3BU83gJSmnzsR17cqVtq5S0s2hI7WkozvvJspBtwmTje9szAkH//vUETYwXrtq OpgB2CPNC11cJmFKWZvyc0Q4RzIs3928wX3N8gRM0P9xUi8JDTTTpWsdn45+WoRx1ACy FvZsdv/7ORdKoFqfN8fuGYfGYUUsTrYcfik6fzkBycbjkc9ntWLv2rAtgOGhMgLuqWpC Fg4w== X-Gm-Message-State: APjAAAXcbTL2+jQyYc3xxk96Xmh6hs9Fd0RQBuRYCIp6KVhrqBiGg/qx TflHSqRst9YHMRXo3aBfMjQuHNWU X-Google-Smtp-Source: APXvYqxuvr8eFNjAYhey+2oOwDDMqVKAzxPOX/j67I7xRi+8bCMPsyaPMuwFSyqWD0udCvrCMN2koQ== X-Received: by 2002:a17:90b:1243:: with SMTP id gx3mr10019311pjb.117.1576865685422; Fri, 20 Dec 2019 10:14:45 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:44 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 13/15] t1507: stop losing return codes of git commands Date: Fri, 20 Dec 2019 10:16:00 -0800 Message-Id: <63ca18207d58a846f47887926582af9b3c55284e.1576865664.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The return code of git commands are lost when a command is in a non-assignment command substitution in favour of the surrounding command's. Rewrite instances of this so that git commands run on their own. In commit_subject(), use a `tformat` instead of `format` since, previously, we were testing the output of a command substitution which didn't care if there was a trailing newline since it was automatically stripped. Since we use test_cmp() now, the trailing newline matters so use `tformat` to always output it. Signed-off-by: Denton Liu --- t/t1507-rev-parse-upstream.sh | 45 +++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh index 8b4cf8a6e3..d81f289ace 100755 --- a/t/t1507-rev-parse-upstream.sh +++ b/t/t1507-rev-parse-upstream.sh @@ -35,7 +35,7 @@ full_name () { commit_subject () { (cd clone && - git show -s --pretty=format:%s "$@") + git show -s --pretty=tformat:%s "$@") } error_message () { @@ -44,18 +44,27 @@ error_message () { } test_expect_success '@{upstream} resolves to correct full name' ' - test refs/remotes/origin/master = "$(full_name @{upstream})" && - test refs/remotes/origin/master = "$(full_name @{UPSTREAM})" && - test refs/remotes/origin/master = "$(full_name @{UpSTReam})" + echo refs/remotes/origin/master >expect && + full_name @{upstream} >actual && + test_cmp expect actual && + full_name @{UPSTREAM} >actual && + test_cmp expect actual && + full_name @{UpSTReam} >actual && + test_cmp expect actual ' test_expect_success '@{u} resolves to correct full name' ' - test refs/remotes/origin/master = "$(full_name @{u})" && - test refs/remotes/origin/master = "$(full_name @{U})" + echo refs/remotes/origin/master >expect && + full_name @{u} >actual && + test_cmp expect actual && + full_name @{U} >actual && + test_cmp expect actual ' test_expect_success 'my-side@{upstream} resolves to correct full name' ' - test refs/remotes/origin/side = "$(full_name my-side@{u})" + echo refs/remotes/origin/side >expect && + full_name my-side@{u} >actual && + test_cmp expect actual ' test_expect_success 'upstream of branch with @ in middle' ' @@ -86,8 +95,11 @@ test_expect_success 'my-side@{u} resolves to correct commit' ' git checkout side && test_commit 5 && (cd clone && git fetch) && - test 2 = "$(commit_subject my-side)" && - test 5 = "$(commit_subject my-side@{u})" + echo 2 >expect && + commit_subject my-side >actual && + test_cmp expect actual && + echo 5 >expect && + commit_subject my-side@{u} >actual ' test_expect_success 'not-tracking@{u} fails' ' @@ -99,8 +111,11 @@ test_expect_success 'not-tracking@{u} fails' ' test_expect_success '@{u}@{1} resolves correctly' ' test_commit 6 && (cd clone && git fetch) && - test 5 = $(commit_subject my-side@{u}@{1}) && - test 5 = $(commit_subject my-side@{U}@{1}) + echo 5 >expect && + commit_subject my-side@{u}@{1} >actual && + test_cmp expect actual && + commit_subject my-side@{U}@{1} >actual && + test_cmp expect actual ' test_expect_success '@{u} without specifying branch fails on a detached HEAD' ' @@ -149,7 +164,9 @@ test_expect_success 'checkout other@{u}' ' ' test_expect_success 'branch@{u} works when tracking a local branch' ' - test refs/heads/master = "$(full_name local-master@{u})" + echo refs/heads/master >expect && + full_name local-master@{u} >actual && + test_cmp expect actual ' test_expect_success 'branch@{u} error message when no upstream' ' @@ -203,7 +220,9 @@ test_expect_success 'pull works when tracking a local branch' ' # makes sense if the previous one succeeded test_expect_success '@{u} works when tracking a local branch' ' - test refs/heads/master = "$(full_name @{u})" + echo refs/heads/master >expect && + full_name @{u} >actual && + test_cmp expect actual ' commit=$(git rev-parse HEAD) From patchwork Fri Dec 20 18:16:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306113 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAB7F13A4 for ; Fri, 20 Dec 2019 18:14:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 96A4B20866 for ; Fri, 20 Dec 2019 18:14:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TcSAbXP6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727533AbfLTSOw (ORCPT ); Fri, 20 Dec 2019 13:14:52 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33158 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727534AbfLTSOr (ORCPT ); Fri, 20 Dec 2019 13:14:47 -0500 Received: by mail-pg1-f196.google.com with SMTP id 6so5333425pgk.0 for ; Fri, 20 Dec 2019 10:14:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RD1xYedwlsBj9gbr+CqlHSkDxXhwhE2Z6Ug+R2zhg4g=; b=TcSAbXP63/U5deGq6CeKKU7OQKB94pAykMSfLUr04AIiMEEixsEQy/i5NvRBMdEk+3 xZf2MLLPXofrwZyMXDgs4yjr6wT3h6M/GDy+ZvZQOSqEH9tbmU1ngLPSHVc52Mivu0Co XyYdZDsbGNF3GAcq+Y6C2s/FOiEEFrJ8uyntYJ624jVKCvdEWqlyc6cm2kN88NnYlO2d bap6FdVifouC8/LI1xXi8m429BHEIoTIZgZ/k+ZyRFRSxQBf/y8FxeIeIfRdsH6xbdc+ uneIueqpIoXBGimHr8cY3XgMqZ55HxLG0XTlhG3xa1vsxltOYnAvQwYkAgIm2osWPDU/ z/xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RD1xYedwlsBj9gbr+CqlHSkDxXhwhE2Z6Ug+R2zhg4g=; b=jdVnVIflsqqCbhf17jHSIp4PGuxHl4x/55aGuRYlvVHptrfw2guLVCRfsHYi2jH3yI Ker5TzEy6hH1c4Z9y3CNOfDKiLgjjLv7LnV3T7UwioOMbFLlhjv4xAbsjRfgIphuDB32 Lo1oikl33ECiBm1BNyu6CLNksAOYeg0guLe0yUJGukQinGFC67gwDuB5f1c4zZtxHV8X ekdcjCbjvq+8loaXAoNpf6/+OKXsqYKV0XFn5UEhv9ZcpmoFnurdDyigHSe/ss4uzEP+ ZYN2FMPAJYuCQebinHG6qVmK6Bl8z7MZJm0extlGY5SLcfFATmTW760M0cW1N4Fwbfep tmXw== X-Gm-Message-State: APjAAAXtRhnqnQh7U/uGEfZOlVp47jKU7+wMxGOiCiq5qpGJTfTKMFgy 4+id4EQ7UT7twCCoM66Q+rMYLcKl X-Google-Smtp-Source: APXvYqwNbyuHLp1GtoXufH9efz2dImbFY6jMxR5TALwwEbKJDexY5LYnDBbDPby/SkzeO53YR+AK0g== X-Received: by 2002:a62:be0a:: with SMTP id l10mr10633507pff.187.1576865686211; Fri, 20 Dec 2019 10:14:46 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:45 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 14/15] t1507: run commands within test_expect_success Date: Fri, 20 Dec 2019 10:16:01 -0800 Message-Id: <44a410d57a3e9c25c609a23619d48b471e5057b5.1576865664.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The expected test style is to have all commands tested within a test_expect_success block. Move the generation of the 'expect' text into their corresponding blocks. While we're at it, insert a second `commit=$(git rev-parse HEAD)` into the next test case so that it's clear where $commit is coming from. The biggest advantage of doing this is that we now check the return code of `git rev-parse HEAD` so we can catch it in case it fails. This patch is best viewed with `--color-moved --ignore-all-space`. Signed-off-by: Denton Liu --- t/t1507-rev-parse-upstream.sh | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh index d81f289ace..f68b77e7ba 100755 --- a/t/t1507-rev-parse-upstream.sh +++ b/t/t1507-rev-parse-upstream.sh @@ -225,32 +225,32 @@ test_expect_success '@{u} works when tracking a local branch' ' test_cmp expect actual ' -commit=$(git rev-parse HEAD) -cat >expect <) -Reflog message: branch: Created from HEAD -Author: A U Thor -Date: Thu Apr 7 15:15:13 2005 -0700 - - 3 -EOF test_expect_success 'log -g other@{u}' ' + commit=$(git rev-parse HEAD) && + cat >expect <<-EOF && + commit $commit + Reflog: master@{0} (C O Mitter ) + Reflog message: branch: Created from HEAD + Author: A U Thor + Date: Thu Apr 7 15:15:13 2005 -0700 + + 3 + EOF git log -1 -g other@{u} >actual && test_cmp expect actual ' -cat >expect <) -Reflog message: branch: Created from HEAD -Author: A U Thor -Date: Thu Apr 7 15:15:13 2005 -0700 - - 3 -EOF - test_expect_success 'log -g other@{u}@{now}' ' + commit=$(git rev-parse HEAD) && + cat >expect <<-EOF && + commit $commit + Reflog: master@{Thu Apr 7 15:17:13 2005 -0700} (C O Mitter ) + Reflog message: branch: Created from HEAD + Author: A U Thor + Date: Thu Apr 7 15:15:13 2005 -0700 + + 3 + EOF git log -1 -g other@{u}@{now} >actual && test_cmp expect actual ' From patchwork Fri Dec 20 18:16:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11306115 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 438A5109A for ; Fri, 20 Dec 2019 18:14:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 183A720866 for ; Fri, 20 Dec 2019 18:14:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Uj5ILEyg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727561AbfLTSOx (ORCPT ); Fri, 20 Dec 2019 13:14:53 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36178 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727531AbfLTSOs (ORCPT ); Fri, 20 Dec 2019 13:14:48 -0500 Received: by mail-pf1-f195.google.com with SMTP id x184so5645688pfb.3 for ; Fri, 20 Dec 2019 10:14:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vKYLPG02vVVLMxYbouq+GE4jjP3H+Ekb7R2xtayR5fQ=; b=Uj5ILEygTWfTBa7x2RESnTmsLfelSIMZcRNsXvweF87WhE+mQHhALJRF698K9bm79i ZYl6HS2tA8vq2h3Q/ON7d5IXzy/Lc4QXZfEurbrWUhVsBPkONIelMbuWX6lFbGjDJDhy bdbl5OyHXKApJFtdIq775slV+AGD27Z+Gsx1SGxDUKHtJet6lp1YMtAvkSa4iGozp7be 8GR8hWW4vMPUo06Ja3lBTncIwf9CRW+xgNlUMdL3a8udzB5vAEWS8y2nalotk6Lyc9eX I87M/eQcevEzS4KeRkg4CNO+/0njScnEuWAd58bVnacr5IQu3UnspxYkTjOynu6jcRF9 M2bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vKYLPG02vVVLMxYbouq+GE4jjP3H+Ekb7R2xtayR5fQ=; b=iqv+cM1dnDEeR238fiPH1NUTNITJpWVZ31HwW7JCD9NDMOQ3q5ktOCnn+kmXGXCjh6 0Gnjy3k4AcSqPU8V7Cw+Xdjc37glR6o1V7PSLItcvhxpAChfPO1AOA32VcplyiqwsE5w 0Jo4Sj23DEi2zFQv4xvE+6MT6nB0+2qwOZrBipv2A3xN7iqc9XLB6zz+PfKXRBzV4Dho gbVFY/6sl/VNGU58UGjRWFtBeCm4vRyE/NIOxE6dxbomXkk9pFbNwW9YB2Kq+lUdh8IN re5B/wOXddUsvBVgBP5D1lj9a5WtICNfWdNrjMu3jz9ykExUwZKFXqmNrRbEPisHf/ng X1vA== X-Gm-Message-State: APjAAAUUwE/mnMU91sRfk8jvuie4pXe2tjCqIr+fl5eXpHhggbYdniKM n9a1uadfUeG8bsnI5TKHNsr5cn2o X-Google-Smtp-Source: APXvYqy9GN4fwIOR2rpJJv3361slks+nNEPiy7uq5wBPPNKg7A8Yhinj0QfeWlEr2DSzIWK8GjKV/Q== X-Received: by 2002:a63:d047:: with SMTP id s7mr15928951pgi.81.1576865687025; Fri, 20 Dec 2019 10:14:47 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com.com ([204.14.239.53]) by smtp.gmail.com with ESMTPSA id c78sm14063082pfb.122.2019.12.20.10.14.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Dec 2019 10:14:46 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v3 15/15] t1507: inline full_name() Date: Fri, 20 Dec 2019 10:16:02 -0800 Message-Id: <4fe445279b715b3a49e7635adc1af152de183bff.1576865664.git.liu.denton@gmail.com> X-Mailer: git-send-email 2.24.1.703.g2f499f1283 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Before, we were running `test_must_fail full_name`. However, `test_must_fail` should only be used on git commands. Inline full_name() so that we can use test_must_fail on the git command directly. When full_name() was introduced in 28fb84382b (Introduce @{upstream} notation, 2009-09-10), the `git -C` option wasn't available yet (since it was introduced in 44e1e4d67d (git: run in a directory given with -C option, 2013-09-09)). As a result, the helper function removed the need to manually cd each time. However, since `git -C` is available now, we can just use that instead and inline full_name(). An alternate approach was taken where we taught full_name() to accept an optional `!` arg to trigger test_must_fail behavior. However, this added more unnecessary complexity than inlining so we inline instead. Signed-off-by: Denton Liu --- t/t1507-rev-parse-upstream.sh | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh index f68b77e7ba..dfc0d96d8a 100755 --- a/t/t1507-rev-parse-upstream.sh +++ b/t/t1507-rev-parse-upstream.sh @@ -28,11 +28,6 @@ test_expect_success 'setup' ' ) ' -full_name () { - (cd clone && - git rev-parse --symbolic-full-name "$@") -} - commit_subject () { (cd clone && git show -s --pretty=tformat:%s "$@") @@ -45,50 +40,50 @@ error_message () { test_expect_success '@{upstream} resolves to correct full name' ' echo refs/remotes/origin/master >expect && - full_name @{upstream} >actual && + git -C clone rev-parse --symbolic-full-name @{upstream} >actual && test_cmp expect actual && - full_name @{UPSTREAM} >actual && + git -C clone rev-parse --symbolic-full-name @{UPSTREAM} >actual && test_cmp expect actual && - full_name @{UpSTReam} >actual && + git -C clone rev-parse --symbolic-full-name @{UpSTReam} >actual && test_cmp expect actual ' test_expect_success '@{u} resolves to correct full name' ' echo refs/remotes/origin/master >expect && - full_name @{u} >actual && + git -C clone rev-parse --symbolic-full-name @{u} >actual && test_cmp expect actual && - full_name @{U} >actual && + git -C clone rev-parse --symbolic-full-name @{U} >actual && test_cmp expect actual ' test_expect_success 'my-side@{upstream} resolves to correct full name' ' echo refs/remotes/origin/side >expect && - full_name my-side@{u} >actual && + git -C clone rev-parse --symbolic-full-name my-side@{u} >actual && test_cmp expect actual ' test_expect_success 'upstream of branch with @ in middle' ' - full_name fun@ny@{u} >actual && + git -C clone rev-parse --symbolic-full-name fun@ny@{u} >actual && echo refs/remotes/origin/side >expect && test_cmp expect actual && - full_name fun@ny@{U} >actual && + git -C clone rev-parse --symbolic-full-name fun@ny@{U} >actual && test_cmp expect actual ' test_expect_success 'upstream of branch with @ at start' ' - full_name @funny@{u} >actual && + git -C clone rev-parse --symbolic-full-name @funny@{u} >actual && echo refs/remotes/origin/side >expect && test_cmp expect actual ' test_expect_success 'upstream of branch with @ at end' ' - full_name funny@@{u} >actual && + git -C clone rev-parse --symbolic-full-name funny@@{u} >actual && echo refs/remotes/origin/side >expect && test_cmp expect actual ' test_expect_success 'refs/heads/my-side@{upstream} does not resolve to my-side{upstream}' ' - test_must_fail full_name refs/heads/my-side@{upstream} + test_must_fail git -C clone rev-parse --symbolic-full-name refs/heads/my-side@{upstream} ' test_expect_success 'my-side@{u} resolves to correct commit' ' @@ -103,9 +98,9 @@ test_expect_success 'my-side@{u} resolves to correct commit' ' ' test_expect_success 'not-tracking@{u} fails' ' - test_must_fail full_name non-tracking@{u} && + test_must_fail git -C clone rev-parse --symbolic-full-name non-tracking@{u} && (cd clone && git checkout --no-track -b non-tracking) && - test_must_fail full_name non-tracking@{u} + test_must_fail git -C clone rev-parse --symbolic-full-name non-tracking@{u} ' test_expect_success '@{u}@{1} resolves correctly' ' @@ -165,7 +160,7 @@ test_expect_success 'checkout other@{u}' ' test_expect_success 'branch@{u} works when tracking a local branch' ' echo refs/heads/master >expect && - full_name local-master@{u} >actual && + git -C clone rev-parse --symbolic-full-name local-master@{u} >actual && test_cmp expect actual ' @@ -221,7 +216,7 @@ test_expect_success 'pull works when tracking a local branch' ' # makes sense if the previous one succeeded test_expect_success '@{u} works when tracking a local branch' ' echo refs/heads/master >expect && - full_name @{u} >actual && + git -C clone rev-parse --symbolic-full-name @{u} >actual && test_cmp expect actual '