From patchwork Wed Feb 23 11:53:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubham Mishra X-Patchwork-Id: 12756828 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 9060DC433EF for ; Wed, 23 Feb 2022 11:54:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239889AbiBWLy6 (ORCPT ); Wed, 23 Feb 2022 06:54:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237739AbiBWLy4 (ORCPT ); Wed, 23 Feb 2022 06:54:56 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B7997BB0 for ; Wed, 23 Feb 2022 03:54:29 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id o8so868977pgf.9 for ; Wed, 23 Feb 2022 03:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sVpzyILp2ztbDvGrYEwfKevqRYLP/6IZT6miX11WaY0=; b=Tzijb2Qlxw+yMnLpO6HVRHSap/zOORDUv7tXyHEGSUs3FbnFZy/jgjVuOZeisHtyk8 ja5+wOC3vo6e6Vu0lKsVZJVi8DKIdhYiK5bxHeZNOzyO2bbJwh8AqqDVobZDGhdUCctQ +b4hjxvpE5/qU1xvclm/fo4HVAv1oWvGl9osjwLkL4ORL+TV8zWdub4Cfpq9EJo6P8bi LXcEt6ELB+vtZnxvY6LY/yRwoRhrVG/b1CV8jLgrnUM54vUsnvrOzxCZ973yC80vZaIr sDZM6yy5IXqSveAM4LKdBcVtbkdv+nrYe1qQOHoQb5katm4wRA21iYZF7WX1HSfvXFdF NxpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sVpzyILp2ztbDvGrYEwfKevqRYLP/6IZT6miX11WaY0=; b=axw1ZzC4mXLB4PIWqIXokgNfTeazCk2S1GxKhO5Tnqe02Y6H4IWEfh8wHxQkUjP0Rs MowPr7eiSkvlM7TI+ou1laeqmKeUVkgeevi2VEhR3doKCUhyXnwskfJq/cGgsR9d2iA3 TAlGK36zuIYsnWgm7MQHB6iYKGRthB/cRUp0o7eWOpb9Rg/GbgZbLpzmjYN5Bd11tr7W Yrk4TST3a8jWimx4yl3Wc4MtPyjuvw64aqIwkKGPmnZV+owtx/f/3XoMPPShyHTtTm2M aN4YnCsMHio3F0pLKrHu6frfDIyAsyvWIi1/fr1eKLC1VBTamjHvbeIIhRA4LtYxYVu9 1voA== X-Gm-Message-State: AOAM533g3uBXSWwWtOJwQDFWxd03fSW1VW0TxsnCHIwz4ZslO7sfftMp mpEcovRa5VFbnKYqvpdKDVCpIm3C0WoFeP9q55U= X-Google-Smtp-Source: ABdhPJwS8hmhmyaX696bL492XegNiWFKYl+jzw0nIxSpDAVg6HHmbGuJLFEBC2VhgGH2ib4G9BVhWQ== X-Received: by 2002:a63:eb46:0:b0:373:3d44:4e7c with SMTP id b6-20020a63eb46000000b003733d444e7cmr23333872pgk.496.1645617268907; Wed, 23 Feb 2022 03:54:28 -0800 (PST) Received: from DESKTOP-MEF584H.localdomain ([103.108.4.99]) by smtp.gmail.com with ESMTPSA id rm6sm2728578pjb.52.2022.02.23.03.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 03:54:28 -0800 (PST) From: Shubham Mishra To: git@vger.kernel.org Cc: me@ttaylorr.com, derrickstolee@github.com, avarab@gmail.com, Shubham Mishra Subject: [PATCH v2 1/2] t0001: avoid pipes with Git on LHS Date: Wed, 23 Feb 2022 17:23:46 +0530 Message-Id: <20220223115347.3083-2-shivam828787@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223115347.3083-1-shivam828787@gmail.com> References: <20220222114313.14921-1-shivam828787@gmail.com> <20220223115347.3083-1-shivam828787@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Pipes ignore error codes of LHS command and thu`s we should not use them with Git in tests. As an alternative, use a 'tmp' file to write the Git output so we can test the exit code. Signed-off-by: Shubham Mishra --- t/t0001-init.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 3235ab4d53..c7dd91cb80 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -489,11 +489,13 @@ test_expect_success 're-init from a linked worktree' ' git worktree add ../linked-worktree && mv .git/info/exclude expected-exclude && cp .git/config expected-config && - find .git/worktrees -print | sort >expected && + find .git/worktrees -print >tmp && + sort tmp >expected && git -C ../linked-worktree init && test_cmp expected-exclude .git/info/exclude && test_cmp expected-config .git/config && - find .git/worktrees -print | sort >actual && + find .git/worktrees -print >tmp && + sort tmp >actual && test_cmp expected actual ) ' From patchwork Wed Feb 23 11:53:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubham Mishra X-Patchwork-Id: 12756829 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 2CA78C433EF for ; Wed, 23 Feb 2022 11:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240095AbiBWLzD (ORCPT ); Wed, 23 Feb 2022 06:55:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237739AbiBWLzA (ORCPT ); Wed, 23 Feb 2022 06:55:00 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2C4C985A2 for ; Wed, 23 Feb 2022 03:54:32 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id z4so19660065pgh.12 for ; Wed, 23 Feb 2022 03:54:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z6gbmk5vEwtI3Jj4AJHDHTFoq4sXxxNVUi8JQhacJmo=; b=JxLmyAi2gEFgCV6Rsm5DT7y3TOtGxWdP1vhCKISp53yHGwSE6hfzUtaAjEM9pcJkfx JCsbifrsfDe/q1BBz8xjegLyxe8UPvgSB+AjtFMLpbOSKd2gYhZ/xzOmCsbq7rFIlF1o /AJsGSuinUt6YTLWaDrdrviEseprsga/eC0ADW2lTVfjglhWbHOMqcQotYX/VlLKSMv4 a/dwXy9g1l3Q49nptgFKBkkL2KsoTY4zPGdrM6Dty9VST5p2StWuzihvuVEGHvjiia+c TnCxJuMDiPPpRlzD4XoHBvW7BfvfJqevQC5HL4haoBnTFV6x7F6ywmQk/q8uyTtdJoVl DiOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z6gbmk5vEwtI3Jj4AJHDHTFoq4sXxxNVUi8JQhacJmo=; b=z81L2dMgfrAh9xEJQnKOlGe+dGHDyxAvb5s+5t3qI1msdiAk+TVSE50LS13feodhla 8h2uU098o0YR3eopxom2DYYxXC1cK4aDHRj47HCtipTRUsNbLsypjOAF5aq1n9ASwlKB klcFY74c2d1w9xcc4DAKhTfvB/XaVyhhK3cuxYLc93dBvfCgWRbbE0Dl3dQqnCqnlQOa jlLEMXQWuquEoaTATPpDaIvHxqnvdaZotwFfzOtDqI1z6cey1zstTJw1RJepyeiNHcg4 V/htBgzSyYxRo/QrrEqxrMjGLr/h21CbBmaBbtzuOL9uSBn6A5ZjLgWsPZvHVA3rKna5 n5VA== X-Gm-Message-State: AOAM530FOyrqly2cgLRLUUMqI6raDaNqWnftxbRB1XQPUkkCExWf7wsM STbq5v7v+SRQXOLjs8Av63Ka0XF8eKqze/1T9QM= X-Google-Smtp-Source: ABdhPJwzr3HnpFD5eIv3+YSgjs8cVYze4GzCF699wCix9CAqymBsBUIVr6qWgfGs1Be1MdBujXGtog== X-Received: by 2002:a63:894a:0:b0:365:8dbf:cd0d with SMTP id v71-20020a63894a000000b003658dbfcd0dmr23065197pgd.5.1645617272084; Wed, 23 Feb 2022 03:54:32 -0800 (PST) Received: from DESKTOP-MEF584H.localdomain ([103.108.4.99]) by smtp.gmail.com with ESMTPSA id rm6sm2728578pjb.52.2022.02.23.03.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 03:54:31 -0800 (PST) From: Shubham Mishra To: git@vger.kernel.org Cc: me@ttaylorr.com, derrickstolee@github.com, avarab@gmail.com, Shubham Mishra Subject: [PATCH v2 2/2] t0003: avoid pipes with Git on LHS Date: Wed, 23 Feb 2022 17:23:47 +0530 Message-Id: <20220223115347.3083-3-shivam828787@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223115347.3083-1-shivam828787@gmail.com> References: <20220222114313.14921-1-shivam828787@gmail.com> <20220223115347.3083-1-shivam828787@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Pipes ignore error codes of LHS command and thus we should not use them with Git in tests. As an alternative, use a 'tmp' file to write the Git output so we can test the exit code. Signed-off-by: Shubham Mishra --- t/t0003-attributes.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index b9ed612af1..143f100517 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -205,15 +205,18 @@ test_expect_success 'attribute test: read paths from stdin' ' test_expect_success 'attribute test: --all option' ' grep -v unspecified specified-all && sed -e "s/:.*//" stdin-all && - git check-attr --stdin --all actual && + git check-attr --stdin --all tmp && + sort tmp >actual && test_cmp specified-all actual ' test_expect_success 'attribute test: --cached option' ' - git check-attr --cached --stdin --all actual && + git check-attr --cached --stdin --all tmp && + sort tmp >actual && test_must_be_empty actual && git add .gitattributes a/.gitattributes a/b/.gitattributes && - git check-attr --cached --stdin --all actual && + git check-attr --cached --stdin --all tmp && + sort tmp >actual && test_cmp specified-all actual '