From patchwork Thu Dec 19 22:22:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304459 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 806C7109A for ; Thu, 19 Dec 2019 22:21:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 579012467E for ; Thu, 19 Dec 2019 22:21:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nTU6T/tC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727162AbfLSWVi (ORCPT ); Thu, 19 Dec 2019 17:21:38 -0500 Received: from mail-pf1-f171.google.com ([209.85.210.171]:42632 "EHLO mail-pf1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727121AbfLSWVh (ORCPT ); Thu, 19 Dec 2019 17:21:37 -0500 Received: by mail-pf1-f171.google.com with SMTP id 4so4068143pfz.9 for ; Thu, 19 Dec 2019 14:21: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=8gqVg+mKGwzsg9uBBepfi+0oVdFuohGoCSh4opBe2r0=; b=nTU6T/tCzSDzBthI5jLnAppo7riyNFHaDFhUxJB3vyy4mSh951HEAZihPaQuC6pwgd zew78JfwkYlYNY0zP0YOK8NqtQPUWej6f2jHAMt13R1PJQfwc8dAX53laKo9Qrwcy6u+ 0G2yfC7nTf1wfjeWLfJ/YMq6XBBTHiEa/SqZPbAw2V2Kbs+TL05ECREPQiiSi+8BBp5L PjEhmeWhpJGnX4NQa8dZheVB86eRtGjKFn4C27KoJTdXt1JSbnmo9w1H0xvcizdjSiFq 5HQ4dLS/8B6ro7nc+PnYfkEMyoXAlb4UY7V0nOzaEYybfMSQ08vQG9A23GYDBkWnI5uk svtQ== 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=8gqVg+mKGwzsg9uBBepfi+0oVdFuohGoCSh4opBe2r0=; b=tj9Y6nxdzLG46/ZWR4X/U3YpDC52rM3BhTk5IKbuDp5gTkkhgy6qhcXiueh6OiDTtM d1GxuPDUH+ic0imyCqV6JZDQIS0dnUq60NhKg7ln9I7J7kFisX831d/5vurrvZrt0hV1 hJcHIR47ATe9n8MfFyum28xVMKnLourGAAvr16iX5QeQ9RoZElIJVDsXHQHw7uiweaL8 mSUM4k8kRhuUQh5ANEYTNK4Q405Xrwxngh7K9T7BuzwoCQ2JyxmpWD/edevXf/aB1YhB X6eXDvfCVfuMIl1lM4SVFMdBXYeuH9hdjWXl0m8dy2ehc5jXr2F47kZjpq0AUSq6XtCg W1Cg== X-Gm-Message-State: APjAAAX80ejtZWCSMT5YKzfE86BwfpPsSGJsaNI+uPOSAQc0SVKoYSQP lH/9AHA2ZFCVn6vkILLsKTjmMumH X-Google-Smtp-Source: APXvYqwFSsyFGCA/wFRQZ9GM830rqNxjEVKIGp+PdeFiLYpseeACoNpuQmZ/yTPpd9e6slg/p+db9Q== X-Received: by 2002:a63:554c:: with SMTP id f12mr11699922pgm.23.1576794096441; Thu, 19 Dec 2019 14:21:36 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:36 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 01/16] test-lib-functions: introduce test_non_git_might_fail() Date: Thu, 19 Dec 2019 14:22:36 -0800 Message-Id: <85cee927656cebed34bc93280d0b2d89e0caa570.1576794144.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 a future commit, we will be preventing the use of the test_must_fail()-family of functions (including test_might_fail()) on non-git comands. To prep for this, introduce the test_non_git_might_fail() function which is used to replace non-git invocations of test_might_fail(). The test_non_git_might_fail() function is a lightweight replacement, always masking the return status of the command and returning a non-error exit code. Unlike test_might_fail(), it does not check for abnormal exit conditions such as a segv. This is because we are not in the business of checking the sanity of the external environment and we can assume that it works properly. Signed-off-by: Denton Liu --- t/test-lib-functions.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 284c52d076..61d27f1ec6 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -891,6 +891,15 @@ test_expect_code () { return 1 } 7>&2 2>&4 +# Similar to test_might_fail, but much simpler. This is intended for use +# with non-git commands that we can assume will work sanely so we don't +# need to check for conditions such as a segv. + +test_non_git_might_fail () { + "$@" 2>&7 + return 0 +} + # test_cmp is a helper function to compare actual and expected output. # You can use it like: # From patchwork Thu Dec 19 22:22:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304461 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 BE2EE109A for ; Thu, 19 Dec 2019 22:21:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9706E24672 for ; Thu, 19 Dec 2019 22:21:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="csP68ywX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727183AbfLSWVj (ORCPT ); Thu, 19 Dec 2019 17:21:39 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:47047 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727128AbfLSWVi (ORCPT ); Thu, 19 Dec 2019 17:21:38 -0500 Received: by mail-pl1-f194.google.com with SMTP id y8so3190324pll.13 for ; Thu, 19 Dec 2019 14:21: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=SR1Way5k+Wj+6Ue6ejt0y/lCWjpKuXZoBOUBpag+XqM=; b=csP68ywXsTzWE88I/Ly7nHCH/3SDs1R1D5hqSYCHSkNagFZq9HPKmvhyLC0pmpX6GO QL8ReUZwLGi/QO+xMJf8lwKXGEsSHLVD9d+yZj5IqfDrefz6Z6N+snhGnuHSjg86rYP/ BYRYyNlgRS6C/VrV3JwdXqbLAbDa4bX/MoXbGDuBYuvke1psYIiThFwLATbt7oCm/+vH H1s9UwGvg1dAuQPKXo+8NDD7Mtf8brrsEhksJTYgLUEpmwuBYr6PLNORtJxjTRoEEnsr JI9DDhLVNzec11bX1mb+7f9vxGH9VFC/zUwlTWrcQABFApIvOfhRYvwsfFrp9zyJsoUj sPDg== 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=ZaeI13Ig1fJsVrU4fT+i1fs5VGOvhrkM4mQUVlWO/4FVrBIV2Y2ZfA+tbiqk3qh2di /2MHMdWhKgc/VfZ1PbSrbkGaeWBO0rJSAnUgzuaexxzfF1XMnMSXNNG+wuiNBfR+w5JJ PZvExdFOVt9NvLcg+9wa6F9mGJftol066rpOdoZAX8eAZNY9my36g9SrAdvR0K1rB1Yh n7KHZFj5nb7n8SukoWv88G5r3tG/NQcaxRiSrln4swOLCOBmVvqsc5aqo3buJScOntp0 4yfmoGNikgybBBnX9DsSrq8Va9IcQMxpouPTyWDouXVEaWbKKRUolk7jOej/+DBO87Bt 1ZKw== X-Gm-Message-State: APjAAAW04rN+aorxYHsATDI8sV0qVsgxXs38FwS2Gbwfw4CrtF+6/Hhu ZjrdbLld4Iqa3fFEsTMHbHDbYqQw X-Google-Smtp-Source: APXvYqzd1m7Ok+5JmIyvr/LgCYokMUWNiEmFPqunHTMohmKbvnnxiuc7Tq++XieiV1uXOfrEaj13mw== X-Received: by 2002:a17:902:7043:: with SMTP id h3mr11667197plt.332.1576794097263; Thu, 19 Dec 2019 14:21:37 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:36 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 02/16] t/lib-git-p4: use test_path_is_missing() Date: Thu, 19 Dec 2019 14:22:37 -0800 Message-Id: <3d64837af1bc2af972ae1415502bbbde26ee3784.1576794144.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 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 Thu Dec 19 22:22:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304471 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 4AABD109A for ; Thu, 19 Dec 2019 22:21:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2789424672 for ; Thu, 19 Dec 2019 22:21:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HXIp2yP3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727264AbfLSWVr (ORCPT ); Thu, 19 Dec 2019 17:21:47 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40848 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727165AbfLSWVj (ORCPT ); Thu, 19 Dec 2019 17:21:39 -0500 Received: by mail-pf1-f193.google.com with SMTP id q8so4072572pfh.7 for ; Thu, 19 Dec 2019 14:21: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=/cHz9jXRyGP9I2nk3E8zlqOrVEHelcTSO/s6fkRs/BM=; b=HXIp2yP3YA5vTmuRnCtTJjVcwEb1Wuih8Qt7GC+sqaVjDiBRCMFbRhzS4FDCjxX46G cNJx0aNF/QK9IDjOkbnNLFz+3oJMPPgKSIc0DofWs+9wjw9E4a8qtp2Q7xCsnzEibiUR FZ9RTX0RpyB4Ea2/INHhVMiw49RN0PgzyvkvbOLUu+VBlYWILEibwkySqEcKZIh/ZbCu +oYCbbzhTUJUU+50B/DN4Q/vusK/mJlOWQoYA9tXu9WQJtz6jHpyJdEJrSuvwZzSwX0b DlABGyiVRkz3Ek2BFB8/VPPKnUKY5LIK3rtoNvHqh8w6GipvZicKhcS3+glEzLNc3LS/ oMCQ== 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=kCo8oODFzc64ZANUKtvkAtGcch4vWmhVJrJD7KkEIdOg/Ns1atXG1lJ93z2ZNpqZo2 Lyj7p3nECXs6qshHsvL7h9dOLp3wBSz4OgqK3Bs/LLtjBAMmR2waWoFoPdDtSPhKrBoF BzikQO7VVX7BGTTdyF/q6Qr2H2WEhD74rsaNd657v0FjPjCUQ+WYRGH6xoAUSAFW0lWN a3bt0ck/okQ0MOW7QkZP1iFTz+El6PwMEk0JWR9tE/ux9PmQB/Cu3UsaAknuevDYAQiB xNDj+Ixl56PTx2SlvJpCRUfBuVcoQLgGuvN8IfhDW3uPnhoQJoQnkmSBi+H7qxUVQQvu m31g== X-Gm-Message-State: APjAAAXCikebkqh6UlqjiQ4+RahRBMoceslcBZO5YioSMh8z6kNmpsO1 WAuXOS0R1aehkxsQsvoLsU+aXIY/ X-Google-Smtp-Source: APXvYqx4ZgzLxfNKGCuMSsSGYtkcfh6lRzssJ2WIA5ZnCC7dbp1y2jVe0BRgkK8qpIrMmS1LeP3hAQ== X-Received: by 2002:a65:42ca:: with SMTP id l10mr11413514pgp.121.1576794098119; Thu, 19 Dec 2019 14:21:38 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:37 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 03/16] t0000: replace test_must_fail with run_sub_test_lib_test_err() Date: Thu, 19 Dec 2019 14:22:38 -0800 Message-Id: <778ae9052bb75c4f574519027917a78d6d61596b.1576794144.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 Thu Dec 19 22:22:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304469 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 1B88A109A for ; Thu, 19 Dec 2019 22:21:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EAF6C2467E for ; Thu, 19 Dec 2019 22:21:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N8U7J6YS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbfLSWVr (ORCPT ); Thu, 19 Dec 2019 17:21:47 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41692 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727184AbfLSWVj (ORCPT ); Thu, 19 Dec 2019 17:21:39 -0500 Received: by mail-pf1-f193.google.com with SMTP id w62so4069046pfw.8 for ; Thu, 19 Dec 2019 14:21: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=wWeg/wl9RrK6mqFq+reQZd+RrvAMP1+PT+GY5lcwJck=; b=N8U7J6YSxGDmmo/IS4/gssUaKbtMv/P6hJJ6fvylhND7vjBdZxvn8RNYLGY6k4eLXz NyKAtjLpFlBFW1avS/0GfWvGzuDAK5geOWpGIS7Q9Lp1mebC2rloC/T+clt9ZaXkKipa ucU2803yxK//Fhki6kxi0pW12G9qtLwlH/hW+tVDBL3uiQh6+6lA6z5qp5zATRtznosG cHVEO/1FoKivqGdgendgUc2ICS4poX8rKaumHvQ9QDAfd12tYspj/T91DKRCJtoxjpJb kxUJGwIjNoedviamfexQTH+s2GtzXLlmMkfQUqr3IJiOjS6PFEWSH7YvUZUxyZJCK5ls W6yw== 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=SQTxMQP5QvVa/ts/2r7YPccG5Lsn3sNnCjtV1fRkRAzzCuRT1QFkwCkat63m9K00rL WzwmplSxrA/sqNacTP5i7r6DOY+WAEoMnMbuwz0I2Qc7N6WlUue3K5r+vW/IBWDeUOzK +QtJcdSggNdrhG3rjaUz1hTgzVgQiXdyRywi4yETrQwdgxfCySC5Pm4BiUYFb6npqrna p44S/CnIGYfGQOpPIqwzkIaNpoqDIAh/W7LJCN2rW7KV1+4y0hrBh7fn5k3Xh0IgkxcG v0geoyd447wwaAmzVSm1NQSm4deoSlnUHnDZlJfQSlGiyb3DSFFwQ6p3/7BBl+StIDE+ lTyg== X-Gm-Message-State: APjAAAW49XF6I6o+kvvnhr3E8N3TrltDLniRSB27rXqWtqa1igEYl9AN f4t8SwBXlBG/8gX3W5JQUzNM+vIy X-Google-Smtp-Source: APXvYqwwOgfbQ9buJ0iBC0dkdaU2svIOLP6NCkNn3feon0XsoJOq2oulu2Oscd5eFacm0KWq9ltzyQ== X-Received: by 2002:a63:fb05:: with SMTP id o5mr11577951pgh.355.1576794098956; Thu, 19 Dec 2019 14:21:38 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:38 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 04/16] t0003: use named parameters in attr_check() Date: Thu, 19 Dec 2019 14:22:39 -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 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 Thu Dec 19 22:22:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304483 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 A22D0109A for ; Thu, 19 Dec 2019 22:21:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 807662467E for ; Thu, 19 Dec 2019 22:21:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V7jVQvgy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727208AbfLSWVo (ORCPT ); Thu, 19 Dec 2019 17:21:44 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:50987 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727190AbfLSWVk (ORCPT ); Thu, 19 Dec 2019 17:21:40 -0500 Received: by mail-pj1-f66.google.com with SMTP id r67so3176301pjb.0 for ; Thu, 19 Dec 2019 14:21: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=ISkCmzf91CTIU8RodTdihc1hjhX0gWKk58ZbMkwYFMI=; b=V7jVQvgyT4LDFZf8FMY5F743hpvP9tMz8cyi53ZY+v8KNgGk/cf0qfb1alwPeLUwEJ plo/tajgPnhETZCqJEDnHsOGiJTLoa5+GaFum2LwwlgG+5j/X+eYQiDNTa9/Ho4sdu69 4BJ0gh5x0Cd2Y2IBq7wNd6zzZ+z1WwzK7YiEqW9edEKtc1hnFjPZYe+1blM5eZEeEIns eOn9EcsZ6zwci1tLvNkcr+3cFUN264IfA8FAxKDxWfWbHwh3vcqf12H7z4NaFNFctMlA To3pEv1RLGuF+D+8PPyuwy+snDqLCKYo0XHMsw5olaNMleFKWd7osSt7e2Dw8Gbfg69h LrzA== 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=EHUl1RiP0D1dPEkMiR8bpjx4a/Bv6jnJs07abEjNlkS7AM4/V/xQdFVutlNw25L4jX wKi82/nXF9f5ztONRFrDTcIGlNEQm9pEMqXoVTgYnEwhBQT+Wyb75ldDL3Q2hACsJGNa /0QnRa5mz9o62j43y+3oAGJcbfScpFvlnw/+v5j7Q+Vw2QHwNgB6yuNOZlAtlto3H8Aw Hph/ZmzYeJrDzkza/tN2eqnnbTYaGECOslPccT7UoREnGS2F4Bq6pYZTcmiWLpNRri4z Y7OkNgBBtrSjw1mYIS99C/nuNRHznNJ5ypbpmaKHb2ax+krYGd5Ytcl2pH/acL+2CHxZ clvQ== X-Gm-Message-State: APjAAAUlBhI5NE6uhEPHnSSATZJ9CqK9qEIM8mGKSGiFST+LUohIQ5ro zopnBFLNISonYlG2POAh25kByhb5 X-Google-Smtp-Source: APXvYqxTXDRTMOKA/iXeERsldYHhPSA6LpbdkmXcPN/NSvXGUUa4LjvHAeJ45NNKOFl2lPZlyjorLA== X-Received: by 2002:a17:902:8541:: with SMTP id d1mr11839245plo.57.1576794099718; Thu, 19 Dec 2019 14:21:39 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:39 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 05/16] t0003: use test_must_be_empty() Date: Thu, 19 Dec 2019 14:22:40 -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 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 Thu Dec 19 22:22:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304465 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 CF2EA1580 for ; Thu, 19 Dec 2019 22:21:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5A102467E for ; Thu, 19 Dec 2019 22:21:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vPxFKNPJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727217AbfLSWVo (ORCPT ); Thu, 19 Dec 2019 17:21:44 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:41037 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726866AbfLSWVl (ORCPT ); Thu, 19 Dec 2019 17:21:41 -0500 Received: by mail-pl1-f196.google.com with SMTP id bd4so3202890plb.8 for ; Thu, 19 Dec 2019 14:21: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=ttleWsc2r7j1vRbYriqwoN83seuUddyDy7i7ATQAyS8=; b=vPxFKNPJsIBPS1yAt0E0zlO4Pb1aSPSG93XW2pPUWdXSBaqYz86hhPWpj1y0INSn2B AqyAtcwiFGMJ3OrrrHUJ1RwsBvPqvTcotafphWVnQ8JWaHdCZYvl5RpRCbfxFUHTk8cx Usy3uVXOJPW6x+ktD5/QlPLOO1Ltd+Q+VRJz6Q2y170tgcKYTqDAAIg/Iz4kKQffl5uv Zgn8pfhSCkbXq54yYA1xoG4ShPolV5afd5o4oOcNMFxfE1dP0ghvEb0gPCvMmpE79a/q XR48kiTlB+Be3UvAhrkcfPROTGzFHa1VIyPMHiEUFbZfW4tIhRvACdKR+pEeONuFv/z6 6sSQ== 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=ZmXQL/rLJKPLXdOHG7b3pdufJ/pPcUpi0lB42z1UVdRo5MSJYYLEu+PQBDKpMmQKh7 wUgJLvo/DY2mueyzsA/t9FLDXCePoFDrS1vj1HSrpqYfRrDjRwjUnXUCzjxdJZA+M0r7 oqnWVFvlYBdjBtnMMzs1nY6k7Td8KmG6GiZ00QkPdG11tcKPO5/jWXEtmHVmTAx15LRd wWt0KuRenmlTfIUAumQOBg26DPgUnJpS/vO8JGPhZ4eN5bNXmNNb+SK2z2VIPr1wfHCn cQKzLDbgNHnDcO+LJyo116M4/zw9RLw5qB1dfcpgDZftPQ599UmfZqsTm/LcbgAnmx8B niQQ== X-Gm-Message-State: APjAAAXBPmVs/3UCEiLCEjSlgPXpmLEFDiEefP/+vC9PC6bRAPL6BpE5 K6TU39lKfwQyqkNLS1zpsxwQBeDR X-Google-Smtp-Source: APXvYqxychOTGXy+8fj4TgeRVKr+FSUqXDxZsTnwZCAyqKuCKwZGZxJFjATxKCWnjzYIhvZLMPKOuA== X-Received: by 2002:a17:902:be10:: with SMTP id r16mr11699789pls.169.1576794100603; Thu, 19 Dec 2019 14:21:40 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:40 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 06/16] t0003: don't use `test_must_fail attr_check` Date: Thu, 19 Dec 2019 14:22:41 -0800 Message-Id: <219011f983e759338d41b661f480b1880bdec6ff.1576794144.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 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 Thu Dec 19 22:22:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304467 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 6D9C213B6 for ; Thu, 19 Dec 2019 22:21:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A9B02467E for ; Thu, 19 Dec 2019 22:21:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vhxduOad" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727225AbfLSWVp (ORCPT ); Thu, 19 Dec 2019 17:21:45 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:43896 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727191AbfLSWVm (ORCPT ); Thu, 19 Dec 2019 17:21:42 -0500 Received: by mail-pl1-f196.google.com with SMTP id p27so3197304pli.10 for ; Thu, 19 Dec 2019 14:21: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=gk5ZJhKfpe1whOMTpaFphgIH3CNUsLpTz28Dli3F+m4=; b=vhxduOadd/1k9Z675vGio+s7oblf0wPYjzRvjBzI1MYJ2+3rTLMBRsEEIbIPtTJBpK 8Rc/EMy8n6xsO4cQf0IMSzOIXWpATvYUAAnGgjuhii2m26AHrerFcw5Sia55iPDMVzNl OL22pF0W9Vcwd0FBSmD46FJg6H674lGDL8XYpB5+rtL4ni+uPu4IWWgeOvgupe8Y1KNC HLomtI/TOftHcM4j4FAx/g4V2Xupwvt2Uaq2yt32lz21TYqiil1RXJiaQqX/OtC9Jr3i 0MsWTrLFogDdw48lQrYCb9VbLrktzTLJb6V1zZK8gVBIPu6DoWtoiUaplpzoApRhxv4r UoNA== 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=PcBg4E9ngXAgY1rC4cjeG1Y327BTq9oKTZuMW3HuyqsBuJZ1G9CYraF57sivMWEz/E CLXpAex0MKbwvhV4dh/MX3kA22F/9i94bOHHXz/Eq+GTaGUgk8OLr/W9vHsroHDqJCQb I7Q8viE1gXxI5H0E1+jq9rQ2E8FBNCXP7nuryake9idv4SJEw3cf6wf+2nD27wEnuxeQ mD9Sa09s8eX+GZAKfgBa56+WoG5TWQn9Q4RIlPa9iWTxHJXsiFg5EwrZiiVzdWXZB4/d p9P059rho6yMsDUqNuol3vQWqahtteIXL6wsJ7UwMD8S6Dky1FxV57qz2TbFwHfQdY5I OzDA== X-Gm-Message-State: APjAAAVuY0DbXjQmGpreqFfvpiS3ui5E/WxbT3xV+Iljpu3p+mnjpVuU aUZR3GMCSDtwpTEJGZBOmppmzCAA X-Google-Smtp-Source: APXvYqwVt6aP2Fddsf2Kpbq0Ue+pd5+QwyJyRF7gP1w4T7jE31XHUKOO6nQm3hiOd/K5gq/AfiJiiA== X-Received: by 2002:a17:902:fe98:: with SMTP id x24mr11544299plm.155.1576794101321; Thu, 19 Dec 2019 14:21:41 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:40 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 07/16] t0020: don't use `test_must_fail has_cr` Date: Thu, 19 Dec 2019 14:22:42 -0800 Message-Id: <8da6c96b39183bc1f6b8b40a2345876017d53921.1576794144.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. 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 Thu Dec 19 22:22:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304481 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 2B34C109A for ; Thu, 19 Dec 2019 22:21:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07FB424672 for ; Thu, 19 Dec 2019 22:21:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cwE4ms92" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727215AbfLSWVo (ORCPT ); Thu, 19 Dec 2019 17:21:44 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:53286 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727193AbfLSWVn (ORCPT ); Thu, 19 Dec 2019 17:21:43 -0500 Received: by mail-pj1-f65.google.com with SMTP id n96so3175637pjc.3 for ; Thu, 19 Dec 2019 14:21: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=JALWx8kavwlDW5GZC+ZEtTUpTnn8GUR/cS+EbnJCO8w=; b=cwE4ms92Z7o49zf1qdq9LzchRwzOMJsxFYfHTVhl14nJwwbs6/hy7yYKQuBYA6L8CM EvjcbKPwTjfxnIctgX1scVELPbadxSw5hczba2STkfJi6aCr1OPCsTEiwat91OTmKUAn 0oJmGY+sOk4qfhGN8IzAMoXL6TYbgi345azHVxoQERQOeNx+C+f9pCBbEBKZW1nt+0+3 s+3gW2WJZZ9NUEurvXnr1yvp9nHQn042p0lXbncuROEa7XwYSbvt9iu8cuX69jrUl9ss kQV+u2rFo4z/w6LSIfFPw3Hdx3ERU/vmToVkbSHr+ZljMET9TG5CkdNQEyIesKiGpX+q rmPA== 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=nQUeVAWvYxXTA9RfimCCUAZfHKWdEKaJtIEMvfOqqNPU1UnoDl7rXsKx5NebBgDW4Q DFjgnPMmXL+R+v3hCnXucIAgcF4TN1bI1g+/hH0VnzUo6enkxtCCqCFqhGF6NcmG3vB0 RgHW4PnvuuNm/UtfINS4BLgIURAv9EOotXcg87kVQgaAwPlOFkhLWOlR2DBpRgg/yDm7 TxPk6udi2HjC/0MRK1v9FujzLhhpqZE6ocrftAR/qmMMeJzoLfm8qpR82si6Cu7YWgNt L1nqB3jDWjybm1G6O/OzOaKM0dxDL76cc6358A6JS0i2ph8aSP8htAGoy7fw3/sw2Y8o RHjw== X-Gm-Message-State: APjAAAVfskO/X3B9z4SURHUTbocrlXelpPDesDHFxSJkvsgKsPwLAbyG KoZexc5V7N/qOnXpG4QO4XlIvKoQ X-Google-Smtp-Source: APXvYqzOoV493nFqOtPeR/eX1oU5hREOd3bMPylOnxFjddFt8Y9kk4ld9ztfHnXZsUuk5S2rn22F3g== X-Received: by 2002:a17:902:9048:: with SMTP id w8mr11388157plz.294.1576794102346; Thu, 19 Dec 2019 14:21:42 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:41 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 08/16] t0020: use ! check_packed_refs_marked Date: Thu, 19 Dec 2019 14:22:43 -0800 Message-Id: <27550eaae6d4944be6090541a4940c818099216c.1576794144.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. 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 Thu Dec 19 22:22:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304479 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 37FFE1892 for ; Thu, 19 Dec 2019 22:21:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 157FB2467F for ; Thu, 19 Dec 2019 22:21:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YWEoi0sQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727266AbfLSWVs (ORCPT ); Thu, 19 Dec 2019 17:21:48 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38820 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727197AbfLSWVn (ORCPT ); Thu, 19 Dec 2019 17:21:43 -0500 Received: by mail-pf1-f195.google.com with SMTP id x185so4078235pfc.5 for ; Thu, 19 Dec 2019 14:21: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=x2mUy2uXMcc2KMq6HG3rtk0SZXxq/MwIutBy33gHbX0=; b=YWEoi0sQ9wp3I5J7LOixShziX+k9ducn4oC45w74JLU2zGImkzIYl+j2T4R9JhSI6I kbhvf/lxpkGO2yau35IR7h9T4dkwYS9ojI/YsqxlMopmMS5yKVSIgTGXHCA7dGfm/ooF 48B0lecWRXopX/zigVfatq6BrqPPLrHweHORC1Rhrylecm7BjmwR6ke6fS66P1gr47bD zQfsAIrdw/uhIeFtpNldqsPV+KrI5XKPenmsajwFZVsefjcq/ObcRg0L3Gs4/Ggys/Ml 0FkcJtlrE5naiPEpKevERrg4kGDp/R1XKysJ1md6/IFBgfa01TaD9oIjPTU0PdjfvEaY WqOA== 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=RTt5c2QpCBroJhOUY1WNOk+QyOZPJeE6BKUUd/xfkqBZa+RxaJK7p5zBRquauhG6Cz QPvWEsb1lXGYbAagIkafSTPCKKGME53TZjp3y48eODk81IKC4s02bbLK/xmhldX57VwQ pnk0RV7wziE06SV5R1hAPF5DrinyG6x7fVz6EVe4rOn674d6AcVs8JOj6GbXh1sOQHDA KS665Eq2i3wzDY0oj8JIjlkA3LgA75HFoGip1XjRPt4C0DPSct44q+A8Tcb1oJR5pbmu EBjTZNxYhuYFZdvfNqq2ghWrLJ7MjrpNhLiosaPoyEFc6r+8F0ArIGApP8v/U6nVJQQh 7FOw== X-Gm-Message-State: APjAAAWXKfBmLV4oYK2Pdo/uXT1Oh6xuaROUxfPvwEUVHZ44BiUthFyS FVZH6IVbr3PLolOidTEivU7PBelt X-Google-Smtp-Source: APXvYqw3UtplD9cX/l9QZvzTsAsnMETQ1MBClwHG5YjgA5nxcGAY5m+Y1H1DZDOGzx2+25AeaM9/+Q== X-Received: by 2002:aa7:9d87:: with SMTP id f7mr12181115pfq.138.1576794103091; Thu, 19 Dec 2019 14:21:43 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:42 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 09/16] t1306: convert `test_might_fail rm` to `rm -f` Date: Thu, 19 Dec 2019 14:22:44 -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 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 Thu Dec 19 22:22:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304473 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 D76A013B6 for ; Thu, 19 Dec 2019 22:21:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B44642467E for ; Thu, 19 Dec 2019 22:21:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bzi0bwjk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727274AbfLSWVt (ORCPT ); Thu, 19 Dec 2019 17:21:49 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33420 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727211AbfLSWVo (ORCPT ); Thu, 19 Dec 2019 17:21:44 -0500 Received: by mail-pl1-f193.google.com with SMTP id c13so3214083pls.0 for ; Thu, 19 Dec 2019 14:21: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=cq3i6CU2w1OvkLOnIHEPmtZ2dO3HE+MsuoDzwGrRs/Q=; b=bzi0bwjkdPXYG1qlJ7x7sgyrcKISEAvt2kazPMa/qZ8nNlYgw5lLxb9ugd4GDQoS9h r7h36kNznjN0E5/KH1lW+iPg/YqDV9s0Ho33e0gNE6c94YGtjydhoMbdlpEkLYjbwtlI FHzY89O5hrnEAlpv3uCLXNmH+utWNrS3N4WtOj07q5/TfijEImJfWBsR62O0/3qp0fNJ e6X08pvxJVF70nw0fD66P+x0271Xbo5vq5exCY5BnhIGpLThbNq3ybYHlKlOneG5xmzo K88JdU17EhdesUFWR2iAMKYXKfpfPllTsquY53eyjidK+G8XJeyu/C/kM0dBcVdkOZ1d eufA== 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=rYZeX1wCNx0Fs4+RYfUAl+9uLviAZycnHBYpqSppblWHQfcjW9w3zhpsynoVgCFVz6 cRQiU1UCifar5pR+qlNFXayOEBEZAUpchJmpj25CnZ2pqyZaz7TadY/gcBbIi0OkSTfe 740Rbky9JBALM2t4HEEfOxPmwBnmydrN7Dv167ZRCiMz6Dwvvf055/iJe8yiY4SzKXNK PG0FtFqbjs3jSQJ2uO0XwMYg6BmvtHA7SkwNvyOflcqekTw+b/Hnr4oXrbucqIOCCcRl KXeOiohgmOdNzKgjqvslsEsxMFgvOGgdGJNnUAq8Pfa9boayIoCnsyll3kde4CHnF1HA D3Gg== X-Gm-Message-State: APjAAAXJvflYFhMm1oI/cq8AaUXXVho3Ug7R7QdVWMZZQMuIQlmKSM3Q moCrlY40YmkrpmleQFibWpWO7UP2 X-Google-Smtp-Source: APXvYqxmDNjwaJL0L0osHKRvBma/aJQ95EuKYMf4v0t6/jxbHOzCplxvOzu4lF5oyXTSoG/SkQehAg== X-Received: by 2002:a17:902:bd4b:: with SMTP id b11mr10485793plx.6.1576794103771; Thu, 19 Dec 2019 14:21:43 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:43 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 10/16] t1307: reorder `nongit test_must_fail` Date: Thu, 19 Dec 2019 14:22:45 -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 Thu Dec 19 22:22:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304475 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 8A85113B6 for ; Thu, 19 Dec 2019 22:21:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67FE924672 for ; Thu, 19 Dec 2019 22:21:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IyUKS9wj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727282AbfLSWVv (ORCPT ); Thu, 19 Dec 2019 17:21:51 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35971 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727218AbfLSWVp (ORCPT ); Thu, 19 Dec 2019 17:21:45 -0500 Received: by mail-pf1-f194.google.com with SMTP id x184so4084727pfb.3 for ; Thu, 19 Dec 2019 14:21:45 -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=IyUKS9wjqdoPmeVCKsufEaFsRxVk4dnB5t+pctJL6BnOEyrqoDrJeELRoolNtX4lq2 LIl5n5Xi2kkrUIyMz+DK9d12VqRujgHLngcosCOwY7ccg1zdc2t+Xz6tGwLfyt8NDW6j zi8lFelLHDSW5sgXhydTUp72jTRwcoppbq+Zv7ZjxVAjHwb9KI4xeG0kVauCcgWeQPN3 CTw/Z52q4kRYL/UVyJ+xn4EuVpTsVgevWLm3qUPI7FtzW3OXzl8rIvl1L7p2WPJ/AcUJ 844rlYySmp8fCQtmhZns1XK3wEGsC1yfJZYDuKZhpwbiWjUCSmcOvSINh02kBx2f5wdu LH5w== 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=d2sBsyVw4fBmslQSK7Cg3POiH9lFd8FoSjhiH1x3VRQLfFuoR+enzHWSrhd+LFX+up Z3LozrNaQfwjlnRzT+AogiqIgi10ZJg6sbqikE1nMHVcq/Lrh86QXAzSXcQwYAWVnSkK tbCx6kbk8BDHlV9rMXx8VI+ofbEXn+CexnK/V54zEXFKsdS7wunQlu8IKEOxa/bevjQp HBc8PglzhJ1fbi7AqMNUeBCgIoDdK1BKxMGcNa5jcJE5W0uO2Oxp6C7WylZ2wTlILoL3 3ert6M9SOwp/dyMbuam554KSNFKltJOvwu8Frm9N3Tb23eEMSCP/lZnPUSjY6oKNgmvw wbyw== X-Gm-Message-State: APjAAAXVBb2F884M3fo7B3qQN5GQmp4xQmtFrBw4ROP5qZFmEBWiad8s ox9beZ5PteNGVP79jEJNqkmK72we X-Google-Smtp-Source: APXvYqzNy9PGTOVIEVwNI3/j854q5XTz4UZ7EDFwq0d4QM6sLiWYSqK48xz3FL3Jnlt69RgKWDPFeg== X-Received: by 2002:a65:56c6:: with SMTP id w6mr11764226pgs.167.1576794104553; Thu, 19 Dec 2019 14:21:44 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:44 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 11/16] t1409: let sed open its own input file Date: Thu, 19 Dec 2019 14:22:46 -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 Thu Dec 19 22:22:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11304477 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 0CD3F109A for ; Thu, 19 Dec 2019 22:21:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE46E2467F for ; Thu, 19 Dec 2019 22:21:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TmOUFjJj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727278AbfLSWVu (ORCPT ); Thu, 19 Dec 2019 17:21:50 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41823 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727239AbfLSWVq (ORCPT ); Thu, 19 Dec 2019 17:21:46 -0500 Received: by mail-pg1-f193.google.com with SMTP id x8so3869134pgk.8 for ; Thu, 19 Dec 2019 14:21:45 -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=TmOUFjJjHFBNWrdT6m79fMkcEc/fx/QLF58+hMxPKv/Lp9CpRTrVy8dRTquKdXzq69 QPO2Y2W4j1cE7hGUdPBBBeOcHU8rEaNStFGyd28Q+wWAkOIKwfrl2XeK23AfKICzIdMN vWrWVl74zRUkM93F+RzPxAvLuMDBcKNRwAbERF0h40YiMGts+TsHT98HMqT5TqYGplnh WisM00usd27mTjrXyt1L2dRjaZcUy6S+RxIAieB5f6NoX1mx6Jsv5bA/O5axxNeV5HXN AbqaN84jrFodQD2S7gZQB1ZA42Dr41HuHECoywZJ0YGQytaqnxqp922hOm/Jj4g3u4e2 /A9w== 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=tWK7Q4jUY8djKEdvgKvhyviJK1vdaR26XTldsloLONUve+itNk8vR5lWLHUNrXAC+9 z8aykchAhua4bmn13uH/1TDKapRNNENbJ+3HKrubvBSuOar6Mekb8yqbK2baTvRq/kjD a5+DnAcL16htJi0yfiF5P3Aduq0zfjMhGa9srw3AWzzT0So6+nd79JPXFnVPVmdKRPGS wQxAmbWdNmaWx4c4XrwGfKb4GfFIOwU9X9JZzRgkk/OypKlZS+tlWJJakWb2O6/kMo4v NPvr3omfPYnbXAvTlWCUzdUyuj1kUz9soAcuynDb+nk/8N4yn5wPdtjgEgHQE+oXMTre 4Zbw== X-Gm-Message-State: APjAAAVDzqBGslWh1p/e8yh+g4IMIVMbm5fHmZvXYH08f6Ixwz28nGlX 1MTM4aqlZpq9ivBuByHAgg4QI80D X-Google-Smtp-Source: APXvYqx8jOQctmxapK8fbeqfhquUPm8/YDg9ByDOPMf6W/vVgqLHHT+14X8BTcjumPd9P7e1g++aEg== X-Received: by 2002:a65:4c8b:: with SMTP id m11mr11754052pgt.208.1576794105372; Thu, 19 Dec 2019 14:21:45 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:44 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 12/16] t1409: use test_path_is_missing() Date: Thu, 19 Dec 2019 14:22:47 -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. 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 Thu Dec 19 22:22: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: 11304485 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 63C33109A for ; Thu, 19 Dec 2019 22:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 407112467E for ; Thu, 19 Dec 2019 22:21:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P7GXeVM1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727218AbfLSWV4 (ORCPT ); Thu, 19 Dec 2019 17:21:56 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44793 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727252AbfLSWVs (ORCPT ); Thu, 19 Dec 2019 17:21:48 -0500 Received: by mail-pg1-f195.google.com with SMTP id x7so3862843pgl.11 for ; Thu, 19 Dec 2019 14:21: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=3qlewRPUKbEN1Zgr/qeYy3s0HiHn2CrbEOGdInUgm+g=; b=P7GXeVM1XtyDByWl/xt69wL27hJVBkbZKrW+b2C8lgKMKlwnYRomYuOcjjGltdkFFl rzEYlECr6wy0+RC/sz138XAbdnnqNyEdLjjL+9Zoze8EB4c2y09Tbwl1y4vnxwl77Qm2 Vxyr4EN7N3N2YFoiWVvAzbiG9TcevCCPT4ZjIAkGuIxbTxS5DfUWFjDdiGF2FmgZ4bGc GSM2v6ojdvWlKzAqglVKXpqq7iLh5qHJ8DlU9ec938eyx6ZxFvzQ+ebYGXb22yk/D1WT yAyWl61ko0QrGwFqy8UsKkIMTxcK6G3DNhNOz0Zar3ijmDUhEMs1AfqyuxxjTXdPkEXs E2/g== 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=3qlewRPUKbEN1Zgr/qeYy3s0HiHn2CrbEOGdInUgm+g=; b=nWRgM8JyfbuYV8jamGN4Dl1K98V9ZCoakrsbdKyvr7V5113h60v335ZaZb7Z8LYH2g WB+S4aReO7WVaB3XdO6zB5xlxnBYsJIAuuOLXHnXuDuxTgv2m59fp/WqUW5/5rak5wi0 kDru0nlVY1bIbbPpwYxyXjZOV7qJpCVxsb6qzW91HI0/Ha5SmVR9kJK/SCbfegSgIoVJ nh/CkYKyCU3jM8BtPOeqvsNcYiqzqTKnpdJRJW1K6J7dOozwJyLUqNNWcjLdZQFyEkL2 xrFL6t2UZ68f2doOaAZYa8HTXdelNEe/69dcYpfvr9ZMU9uCoYz2r6iOmX4VKNvab+uN VNgQ== X-Gm-Message-State: APjAAAXysEaMVgrh+QaL1ADmgrm6r5bi+RCKfQnfi9hDxklb7RjiNR1T m3Albg3Hj4E3Bqi7buR8viXwxNBd X-Google-Smtp-Source: APXvYqxIjSTwoGyE5FE3GS631hZZrd4Zq8NxkEr+tyfzldQDX5HecwPPSwKnW9uA8o5svyp/Do215A== X-Received: by 2002:a63:1322:: with SMTP id i34mr11659498pgl.163.1576794106183; Thu, 19 Dec 2019 14:21:46 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:45 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 13/16] t1501: remove use of `test_might_fail cp` Date: Thu, 19 Dec 2019 14:22:48 -0800 Message-Id: <83e47748bc9c541c725f6c42c553b1a69fd717ac.1576794144.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() with test_non_git_might_fail(). 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 use test_non_git_might_fail(). 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..067301a5ab 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 && + test_non_git_might_fail cp repo.git/sharedindex.* repo.git/repos/foo && sane_unset GIT_DIR GIT_CONFIG GIT_WORK_TREE ' From patchwork Thu Dec 19 22:22: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: 11304487 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 DCC2813B6 for ; Thu, 19 Dec 2019 22:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB5C82467E for ; Thu, 19 Dec 2019 22:21:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FTKDkibl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727289AbfLSWV4 (ORCPT ); Thu, 19 Dec 2019 17:21:56 -0500 Received: from mail-pg1-f175.google.com ([209.85.215.175]:39800 "EHLO mail-pg1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727265AbfLSWVs (ORCPT ); Thu, 19 Dec 2019 17:21:48 -0500 Received: by mail-pg1-f175.google.com with SMTP id b137so3874032pga.6 for ; Thu, 19 Dec 2019 14:21: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=SeZOY/KKpQY2td5afYkTiUUHcs8wX+Qr20utB7VGqmc=; b=FTKDkibl9U9Iz1XIssR74k7f7xzJKpgpo1dfbHItghhZc1hBiO174DuTQdGbw5GA9l 9bkjnhRCSvknecxiRHoCnYgKZxKE+ahW95z4aFkMRvqYS/cjOE0c9QOIXUTWpaemEJjx RptcS0VBfSOmlb3f3jQobR66ZR4/nC4cKLk1PVsYLkZSVp4mbcwjg/aEXtfaaCb/R9FG Cwlqki8bEjLUF1R5PgoQ+eX/gZLQyzYwYvfTxi6YccmLEyYI8HLxmxBxBhGqtPZbZ+hI jx6XnSmN6/iDy/VgAv7l9EJ0krLAANcwv9Ov4t87YZCD24rmRtl0MgF1j8zTtI/7hKm0 XMKw== 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=uVe1UMD0h1UaASdAgqS0lhHuVCNJPbJPIV4M5IHVj3e7DBJcCgQEM+ePDo6n9h2bCL LfPclS7kUxklf/pLUOS5i6giYvkL0EY6D9RALwkB0kSU6YIdoZwI1ZbGRFZ7F8E526Jq ldJDN1d+gqNIL6fyBKkQn2qabftDwC+A6cevYR7O+iPKtKHjR+qi1mp3FrBo11A46eCV HnF6wOsS4Uv3xBWjQckxW4lHkacsmvan7CKDGbWC2SC7vXW3O/sPk5xUURrPp/41BVYG zi1Q2b//+VC39MQHMdSvEszvqclGZRoDyNcu+HOmMER3/4EeLzwnr8YCvxKZnYeuON/d rpZQ== X-Gm-Message-State: APjAAAWXFwe9A1xiV2W9KEiHf+z6kKZxAApxIJlHSFn3hEDuNI4i0bFB FMTcVCGg0pw7iKZ4WCqxLW4/HJyi X-Google-Smtp-Source: APXvYqwcGD4r41OBdFmb4TDWCoHaMWGbWGO0bZgnMOQJfgPZPNy8mET2yIrNs3xcFVJY29uE2o9Chw== X-Received: by 2002:a63:d406:: with SMTP id a6mr11613993pgh.264.1576794107302; Thu, 19 Dec 2019 14:21:47 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:46 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 14/16] t1507: stop losing return codes of git commands Date: Thu, 19 Dec 2019 14:22:49 -0800 Message-Id: <9e20865f94bd187dd1e50c1ddd57c435882cd6a0.1576794144.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 Thu Dec 19 22:22: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: 11304491 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 4AD9B109A for ; Thu, 19 Dec 2019 22:21:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 296BF2467E for ; Thu, 19 Dec 2019 22:21:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FKAuI1Ll" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727322AbfLSWV6 (ORCPT ); Thu, 19 Dec 2019 17:21:58 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38061 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727197AbfLSWVt (ORCPT ); Thu, 19 Dec 2019 17:21:49 -0500 Received: by mail-pg1-f195.google.com with SMTP id a33so3878346pgm.5 for ; Thu, 19 Dec 2019 14:21:48 -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=FKAuI1LlnVzqbkxlCCQ0Ein6qfmh441aw385ETuNIvMGpjquEIzIEiTuvkpvAi9UCt XOweYAsvP1WPh/gfqGeKfBblyxXlBnX7O5rkkyCNQrgxJRmuTsUHZ0DxhKg307Vetp8T YH0le+a6Or2XZ42Co7+eQdmcWJ54VA5ozaGDer0vdBrE4V94NbWT5ISZG7QHlmGuY9m5 ZedvnKwPrT70ccOdlskWlYj39rcwo0DKOhhMxLhZIPFsoGlAopBlCHKXpKDDVTzbvUuY +7xqENsCIhbRfvBdxPpskEUO5cCaXW0puLQCNJHihZuYhGkCGkg/xgWVlRZaXL+fhc27 zcXQ== 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=er9fGYvDRfVYvasLu+Hx/w3OIpwGu9zjyEiLEvpg5qZN3DdHZv+NYsLRSipcMs3XI2 UetqxYdUiWdvUOdVDssvE1A5qsta7jy42xS+lLhiUHru4vNE9g+pFT3W3KWZW2xOhJKJ 0/D+uK36e4GNmrobqKsOR2D/uJwGFKyyg0gZFFudvPIg2KXaAZCK5OnNI1VSA2NruNX0 n9O+Sn4jXWL09pRuu9ttHKh/hb3MmlMJ3+8k+c/808jfvJi3m83Lm17c6yDek0ShHNaU bIaYAWh07YDaaNP6ZMsCXR6Rj19xrLpNMvC0Q5KbqQyX6bLmLvlGS7SIg+QAunn4czQR JQxw== X-Gm-Message-State: APjAAAXQ+aYzP2ALPzF+NpF1p+FLTyQbbXxd418me/vpKTokvXEzcfoD l6tedQznXgpTYaFbF8PWh2UVVKbP X-Google-Smtp-Source: APXvYqwxjqvOmMN9JpIANfGDpWQ3DxrXkm04Yw7kXeD+VIqIvrJx38SZ4qbxRaJw76y0u68xmUrkeg== X-Received: by 2002:a63:770c:: with SMTP id s12mr11811063pgc.25.1576794108126; Thu, 19 Dec 2019 14:21:48 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:47 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 15/16] t1507: run commands within test_expect_success Date: Thu, 19 Dec 2019 14:22:50 -0800 Message-Id: <7c61ac6b67a32da86fcdafaf4a69f2662efb4bd0.1576794144.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 Thu Dec 19 22:22: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: 11304489 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 5448E109A for ; Thu, 19 Dec 2019 22:21:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 289912467E for ; Thu, 19 Dec 2019 22:21:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EK9ks3z9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727296AbfLSWV5 (ORCPT ); Thu, 19 Dec 2019 17:21:57 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:35413 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726963AbfLSWVu (ORCPT ); Thu, 19 Dec 2019 17:21:50 -0500 Received: by mail-pl1-f195.google.com with SMTP id g6so3211414plt.2 for ; Thu, 19 Dec 2019 14:21:49 -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=EK9ks3z9zhEHSLb5ch+2e8iTlkwPTqmVY1xEWuo+wZ3h5OohFF6/CivJFx82wDiDSz yQgBOBAaqbhQwVkDhwIwPnu3wYU8/4zBo79G383en3QGM4t6aBIP6D3tOirDQha9Sewv 40p/RJWLYnDdILpEUyOSSGuPFi7pFh+P0yqKxuOEtz8Nz+C88GYDxBVBQVtnhc1LMEGw TvKCyhNNu394GXfzhukuJBqat2l3whZ7hXqC6yuCpKm+7mA8tWbq/k6mnYJsKeK0mptp Z2TrgsowPYjvOnwUE8cfl+K40uuu7F7Ksez40sAxBUB4Dc3x4QPaxJzCQOGbYmfMu6ef 9LTw== 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=XkR6BJjpOvj7/hr9GZUiQ97AKKY7EWDSkEpirCb+03sYnRXh6mSaVeM0erosvllqbn qItmGAxgD6QuLUeR1uzbu/BvdF9SlLeM3iG8nktb/uqcqmkcoyKDj+z82QVEG5+lzV53 bHw6Uy4lzb/0NXnB4+NlOVX2u+vVyTaPetkjN0iXf6GMn6BmAH0YaXLO1XJaubap9hJ/ 7YCvRguPT5pnaOunndTxY1V6pNfKqddBehqBd1GaZX19ED9kWgqObjrGg63pUkJvkWzq OnF+VkorQpdU1cndOONJUTUEUfXcLshwP1NnzAHohQ8gPfhr1BisxRrzXmntBQSQi4FY OpBg== X-Gm-Message-State: APjAAAVxoo9s21SrcBUVbT4obZ1FSHUkesQysEiS6AWMAz02/0kXiNEj f8LPVlrZuXhEMjMa1+r64vPMaZjJ X-Google-Smtp-Source: APXvYqwjnWvvPZ2meGBQnU6iYeTDlt1fhmSDaN4xO4P7O0onf9UwCMHAlRZD6WlMX145l8jQN0tCJQ== X-Received: by 2002:a17:902:9a45:: with SMTP id x5mr11790311plv.310.1576794109020; Thu, 19 Dec 2019 14:21:49 -0800 (PST) Received: from dentonliu-ltm.internal.salesforce.com ([216.52.21.197]) by smtp.gmail.com with ESMTPSA id o19sm11428528pjr.2.2019.12.19.14.21.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Dec 2019 14:21:48 -0800 (PST) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , Junio C Hamano Subject: [PATCH v2 16/16] t1507: inline full_name() Date: Thu, 19 Dec 2019 14:22:51 -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 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 '