From patchwork Mon Aug 22 18:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sunshine X-Patchwork-Id: 12951042 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0156FC28D13 for ; Mon, 22 Aug 2022 18:26:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236333AbiHVS0v (ORCPT ); Mon, 22 Aug 2022 14:26:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234096AbiHVS0r (ORCPT ); Mon, 22 Aug 2022 14:26:47 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 708AC481D0 for ; Mon, 22 Aug 2022 11:26:46 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id k6-20020a05600c1c8600b003a54ecc62f6so6479460wms.5 for ; Mon, 22 Aug 2022 11:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=8GjrBUDxUA+1dHZ1zMyoVoPCKa7Y1oWgKjXqnJ6/uuU=; b=Rs3JVi/20iQHiH2U3gA5TBhDvii/enhAHkeIo4ew2GIfJJHB+PzOEcwLZE554zi62L ez6WSMFVpiUxaRUGsyWbWKurIoNQVkVVuZ72XquFvCyEa7mal8IphvQWJuivj/OBiEXF PhJIbbwak1bcrwgOqeYei/tbiY3Yl0qcBVKAd4qTI2+JS1gAVJxGbEqBAEkX8U2UX3bx bCqGx8NOWm8L0aMs/jMOt40ove14Zvu31cvwpkc/+5RCgKwNExqsLIFQRoMjjqQF9/+U aNev7rZtu4lV3OxhF2eojsqJfu9FW86rQ0ly+Fi/aU8QCwxfoEtwPT5NOjWTbHutr63V YIjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=8GjrBUDxUA+1dHZ1zMyoVoPCKa7Y1oWgKjXqnJ6/uuU=; b=2YW8YqTja3pQzFcstdwkJ67nOSZ02eLFdlhNGgVyaMtSnCRm/cFSrSyjmZetfxMW1q WzPvK4QFNPpCzBZC0F2jHZDWvhIVvN/5UD+rGXR9x5s6JCDy93bm+G7f2ZVThD/4cDpb fJY0VXo1/mPbJSgyzxFFdcGYTLuA5q7QYi62zmre+aLV9UX5ay9mLOb0E4rmuABK5Pe1 Mr7+SCWml55kYWTKzYyrkIGNBxPZ9WaklUY9usETA0gxZawt6ojSYGXlWfxIczH+L+tV 3FfD0ypRouBZZaANFsuFJErH0Pxa08Zi2dj8/RFhZbMQc26OLdFDxvYm6MPmhrgkW120 nFew== X-Gm-Message-State: ACgBeo3OTPiYvdIs9qulgQPMaE3WPO6V9IiFAiBPIWC27c2/I45HpqIW XOM/8YjJCfWVP8IkaVZIYHlYZOxlCiU= X-Google-Smtp-Source: AA6agR6WsLNrVgNldvLp3rA1QGEENlXNmAmwPRnUEjyYz3E0N4AX5NrFV8glZPMvHpLTK3QgCBUt7A== X-Received: by 2002:a05:600c:4e94:b0:3a5:b7e5:9e64 with SMTP id f20-20020a05600c4e9400b003a5b7e59e64mr12987378wmq.26.1661192804747; Mon, 22 Aug 2022 11:26:44 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id t15-20020adfe44f000000b0021e4bc9edbfsm12144948wrm.112.2022.08.22.11.26.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 11:26:44 -0700 (PDT) Message-Id: <15d7520479f412d13de17c323311aba077043bf8.1661192802.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 22 Aug 2022 18:26:40 +0000 Subject: [PATCH 1/3] t2407: fix broken &&-chains in compound statement Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Jeff King , Elijah Newren , Fabian Stelzer , Lessley Dennington , Eric Sunshine , Eric Sunshine Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Eric Sunshine From: Eric Sunshine The breaks in the &&-chain in this test went unnoticed because the "magic exit code 117" &&-chain checker built into test-lib.sh only recognizes broken &&-chains at the top-level; it does not work within `{...}` groups, `(...)` subshells, `$(...)` substitutions, or within bodies of compound statements, such as `if`, `for`, `while`, `case`, etc. Furthermore, `chainlint.sed` detects broken &&-chains only in `(...)` subshells. Thus, the &&-chain breaks in this test fall into the blind spots of the &&-chain linters. Signed-off-by: Eric Sunshine --- t/t2407-worktree-heads.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t2407-worktree-heads.sh b/t/t2407-worktree-heads.sh index 50815acd3e8..019a40df2ca 100755 --- a/t/t2407-worktree-heads.sh +++ b/t/t2407-worktree-heads.sh @@ -41,10 +41,10 @@ test_expect_success 'setup' ' test_expect_success 'refuse to overwrite: checked out in worktree' ' for i in 1 2 3 4 do - test_must_fail git branch -f wt-$i HEAD 2>err + test_must_fail git branch -f wt-$i HEAD 2>err && grep "cannot force update the branch" err && - test_must_fail git branch -D wt-$i 2>err + test_must_fail git branch -D wt-$i 2>err && grep "Cannot delete branch" err || return 1 done ' From patchwork Mon Aug 22 18:26:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sunshine X-Patchwork-Id: 12951043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0A44C3F6B0 for ; Mon, 22 Aug 2022 18:26:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236660AbiHVS0y (ORCPT ); Mon, 22 Aug 2022 14:26:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236320AbiHVS0s (ORCPT ); Mon, 22 Aug 2022 14:26:48 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C87148C81 for ; Mon, 22 Aug 2022 11:26:47 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id h24so14263501wrb.8 for ; Mon, 22 Aug 2022 11:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=UtFOpsAFtA+0uOV/y++ymgbeFjDHTU0b15sKcoQ4Xck=; b=VJRSKttLCNf0Q/oJpRmKdtGtz/qjG1wrP4idwpxRpOhEWX58fHPThlOmN4RcCzbzM0 amyS3/HFK/T6xvW3em5XbIsjL6uPBODiwP2O7FpEISg1isCTbws+0rNyGLSxinDu4uE0 4nYRdZNLaKRyaOeFhb+COclH1yNPNBoPrP4jQZBY1LDEGTgf4DSc1wOnwiijPrb9b37R cVfsxElL6sA0D+xKc01DIsb8l7b97bh2FpzFfPeeDS+pr29QU9Vd6wgH4gwXMc6oQIt8 hceZKs3T4oj1GtSddaEGdS40G5R6+WAxPo9bJz1sjT8GOS99xXOphkK6UG8/nQPmmtA+ slIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=UtFOpsAFtA+0uOV/y++ymgbeFjDHTU0b15sKcoQ4Xck=; b=60iEVLzY0oGAOCvXeR1L1liLl8Y18GQjiWIRq2hITUs+IlUNSCJiRGW4o0zqFEN1F2 NqRjuhPpWO7nGZba63X0ALrE49p8lvtFao3AkVRBBziF2syzSoZReS8CiDcv4yN+UefC o6aDkrJ4LFhXnuox0TTvoRVa80TOymVBRZhXtx9hhold1sm/+kqmqwnTeOGpPGb7yLLE 9nPZpx/IfpE3Mcg8Gw/O1VBO+C3h+w4fmVYafhstUEJjWMexiVkEWJ4K4IFJwopPT9Ty /LwmX0fAU0Qo+I5nxpTkJHUyq9Z0zBNQSlesC1+zJXVsJMr+/OHzrTpiH6MRo6cb2r6W vkHw== X-Gm-Message-State: ACgBeo2Q4iJVhMNJBHlX7QXiq3CoRA+/HbKkTRtKDjXl6kPonkCgorW8 ESt1w16DwWVCiYPXUZItxkfRHcDU2nE= X-Google-Smtp-Source: AA6agR5ZtxuRYUxpe7+1zC/DQ+2wpwMmuewh0YGbWBehy3kWCWGZvM8bhg0OHnDrX7Gq6MMIW/TtrA== X-Received: by 2002:a05:6000:11ce:b0:225:2e98:2c20 with SMTP id i14-20020a05600011ce00b002252e982c20mr11757415wrx.137.1661192805612; Mon, 22 Aug 2022 11:26:45 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q3-20020a05600000c300b00225285b8136sm11930733wrx.38.2022.08.22.11.26.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 11:26:45 -0700 (PDT) Message-Id: <7b0784056f3cc0c96e9543ae44d0f5a7b0bf85fa.1661192802.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 22 Aug 2022 18:26:41 +0000 Subject: [PATCH 2/3] t1092: fix buggy sparse "blame" test Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Jeff King , Elijah Newren , Fabian Stelzer , Lessley Dennington , Eric Sunshine , Eric Sunshine Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Eric Sunshine From: Eric Sunshine This test wants to verify that `git blame` errors out when asked to blame a file _not_ in the sparse checkout. However, the very first file it asks to blame _is_ present in the checkout, thus `test_must_fail git blame $file` gives an unexpected result (the "blame" succeeds). This problem went unnoticed because the test invokes `test_must_fail git blame $file` in loop but forgets to break out of the loop early upon failure, thus the failure gets swallowed. Fix the test by having it not ask to blame a file present in the sparse checkout, and instead only blame files not present, as intended. While at it, also add the missing `|| return 1` which allowed this bug to go unnoticed. Signed-off-by: Eric Sunshine --- t/t1092-sparse-checkout-compatibility.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index a6a14c8a21f..e13368861ce 100755 --- a/t/t1092-sparse-checkout-compatibility.sh +++ b/t/t1092-sparse-checkout-compatibility.sh @@ -567,7 +567,7 @@ test_expect_success 'blame with pathspec outside sparse definition' ' init_repos && test_sparse_match git sparse-checkout set && - for file in a \ + for file in \ deep/a \ deep/deeper1/a \ deep/deeper1/deepest/a @@ -579,7 +579,7 @@ test_expect_success 'blame with pathspec outside sparse definition' ' # We compare sparse-checkout-err and sparse-index-err in # `test_sparse_match`. Given we know they are the same, we # only check the content of sparse-index-err here. - test_cmp expect sparse-index-err + test_cmp expect sparse-index-err || return 1 done ' From patchwork Mon Aug 22 18:26:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sunshine X-Patchwork-Id: 12951044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05FC9C28D13 for ; Mon, 22 Aug 2022 18:26:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236711AbiHVS04 (ORCPT ); Mon, 22 Aug 2022 14:26:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236362AbiHVS0t (ORCPT ); Mon, 22 Aug 2022 14:26:49 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E990481D0 for ; Mon, 22 Aug 2022 11:26:48 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id u14so14252949wrq.9 for ; Mon, 22 Aug 2022 11:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=Dgfsyhs0RNsaLM3l4sKhqbZHr8ElrsZ6DZM1/8tvoTM=; b=lK6rKXfJi8iBhIqNL2qRfabGuBn6LHsAZ4CW+miitl07n2IKxkVTp3EwOYhwHSHUqK e4qCjDtCgUwOhSO/hwjzfqaDqbmyZclhDmVpJs+UJW3FQLFPwHR9S1Wl25HZqOY5GmNh 7sahLxeOumSw2ZpfkfOC7x6ZGC19pNGr+pOM7YC6oBvxbp3/wrX8oNat/15/DXIW7jk5 97Qg2L5jfQYpkfdtW455yUqWzPfGhkSy7M70oS04MyOOVOYLwiVM/ctdthihqu78Zw+L zH3+ic++SfS8HoLhaxkoobLW/7Ul5AMozKCKwXy7NiQcWpJ8E3Dk7jIruYwdEo26SsmL 0OWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=Dgfsyhs0RNsaLM3l4sKhqbZHr8ElrsZ6DZM1/8tvoTM=; b=6SExWmpUGS4VM84Or4UaPhcysI2kCZsS3fmqEk2KP/uKmiy5WDVY2UxGYCKPR/foYp MQtrrRmyhJItgNtMotWL+fnPgB2apwep4jwNDt8sKhuAVRORUZrngCuKLCc9UngX+lvZ T9t0om36ChukxKKgQ+CtANOGn6CFH3b6qOJN0mObNgxa771BW5wVH0YZykn57aJULdv+ 7RQrlVsINKD1B74QhLnRlXZmw5i+EwmpBupNtwG5EzgcMReSSenA4IbLHCxfxYrCZpCh 2Se8QK3NK7nULyd9COkfg0umP6NZ8020J6hYtnMyHJK2Ge82WiuRkE44TVJTtBpYJ7B7 SXRQ== X-Gm-Message-State: ACgBeo3rLgZzfWP0v+hO1Mea2z0a1H2D3ev8TBwZHlKiJOxU6LqHrfyo nhtGw8bgpQ6sHCOHx7AuJ1VZXCtFQbQ= X-Google-Smtp-Source: AA6agR6n9G7LRDpdc2/G0W8sWUvSiuX5YaGJEp+LV4s5RPiZMn0An7VpT5rK1n1UXn8bYrriWXxmGg== X-Received: by 2002:a5d:47ca:0:b0:220:5cbc:1c59 with SMTP id o10-20020a5d47ca000000b002205cbc1c59mr11346673wrc.662.1661192806525; Mon, 22 Aug 2022 11:26:46 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x17-20020adfec11000000b0020e6ce4dabdsm12529236wrn.103.2022.08.22.11.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 11:26:46 -0700 (PDT) Message-Id: <31a962fd5070d68964e545fb5506d795e8845ec3.1661192802.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 22 Aug 2022 18:26:42 +0000 Subject: [PATCH 3/3] t: detect and signal failure within loop Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Jeff King , Elijah Newren , Fabian Stelzer , Lessley Dennington , Eric Sunshine , Eric Sunshine Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Eric Sunshine From: Eric Sunshine Failures within `for` and `while` loops can go unnoticed if not detected and signaled manually since the loop itself does not abort when a contained command fails, nor will a failure necessarily be detected when the loop finishes since the loop returns the exit code of the last command it ran on the final iteration, which may not be the command which failed. Therefore, detect and signal failures manually within loops using the idiom `|| return 1` (or `|| exit 1` within subshells). Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- t/perf/p7527-builtin-fsmonitor.sh | 2 +- t/t1092-sparse-checkout-compatibility.sh | 6 +++--- t/t5329-pack-objects-cruft.sh | 8 ++++---- t/t6429-merge-sequence-rename-caching.sh | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/t/perf/p7527-builtin-fsmonitor.sh b/t/perf/p7527-builtin-fsmonitor.sh index 9338b9ea008..c3f9a4caa4c 100755 --- a/t/perf/p7527-builtin-fsmonitor.sh +++ b/t/perf/p7527-builtin-fsmonitor.sh @@ -249,7 +249,7 @@ test_expect_success "Cleanup temp and matrix branches" " do for fsm_val in $fsm_values do - cleanup $uc_val $fsm_val + cleanup $uc_val $fsm_val || return 1 done done " diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index e13368861ce..0302e36fd66 100755 --- a/t/t1092-sparse-checkout-compatibility.sh +++ b/t/t1092-sparse-checkout-compatibility.sh @@ -556,7 +556,7 @@ test_expect_success 'blame with pathspec inside sparse definition' ' deep/deeper1/a \ deep/deeper1/deepest/a do - test_all_match git blame $file + test_all_match git blame $file || return 1 done ' @@ -1571,7 +1571,7 @@ test_expect_success 'sparse index is not expanded: blame' ' deep/deeper1/a \ deep/deeper1/deepest/a do - ensure_not_expanded blame $file + ensure_not_expanded blame $file || return 1 done ' @@ -1907,7 +1907,7 @@ test_expect_success 'rm pathspec outside sparse definition' ' test_sparse_match test_must_fail git rm $file && test_sparse_match test_must_fail git rm --cached $file && test_sparse_match git rm --sparse $file && - test_sparse_match git status --porcelain=v2 + test_sparse_match git status --porcelain=v2 || return 1 done && cat >folder1-full <<-EOF && diff --git a/t/t5329-pack-objects-cruft.sh b/t/t5329-pack-objects-cruft.sh index 8968f7a08d8..6049e2c1d78 100755 --- a/t/t5329-pack-objects-cruft.sh +++ b/t/t5329-pack-objects-cruft.sh @@ -29,7 +29,7 @@ basic_cruft_pack_tests () { while read oid do path="$objdir/$(test_oid_to_path "$oid")" && - printf "%s %d\n" "$oid" "$(test-tool chmtime --get "$path")" + printf "%s %d\n" "$oid" "$(test-tool chmtime --get "$path")" || exit 1 done | sort -k1 ) >expect && @@ -232,7 +232,7 @@ test_expect_success 'cruft tags rescue tagged objects' ' while read oid do test-tool chmtime -1000 \ - "$objdir/$(test_oid_to_path $oid)" + "$objdir/$(test_oid_to_path $oid)" || exit 1 done unrelated/$i + >unrelated/$i || exit 1 done && test_seq 2 10 >numbers && test_seq 12 20 >values &&