From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id BC8121F463 for ; Wed, 27 Nov 2019 19:53:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727319AbfK0Txd (ORCPT ); Wed, 27 Nov 2019 14:53:33 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36453 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727279AbfK0Txc (ORCPT ); Wed, 27 Nov 2019 14:53:32 -0500 Received: by mail-pl1-f194.google.com with SMTP id d7so10304989pls.3 for ; Wed, 27 Nov 2019 11:53:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=s+25cXUitbRIILBQxNigN1bTyahqYM675wyaEPunVdE=; b=gUr0TzoUTQoEuCEDE9ZYOSLBJlAhD9gSGzN6V2FTWX+7ymOh7mVNycUq8qOX2QxTWK 3TMSRCQd+5bBpspvFjFcdJr/x3KKWPwOk9cHsrYQnOB740lxeqF7/3dz4p2p1swIY+Rs ApCDM0gra+vKGNyLEExjkRhkpr6S5jI/qKYb5IOCnhD0SAyBNRVTCHZIx6MIEIf2fEFD UcClDX6s2yEXKBqva1MagNLGBruCvk5HHgqXn03xZwdSq3ohLcIxY1e4Efv2qKp/OFpU wuLDCvuh+4bD77uuYSRU10mJow+6hlVUuMl0/kJlpYaaY+4MwZQfvh1dGhbHKc2qbRQ4 KMDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=s+25cXUitbRIILBQxNigN1bTyahqYM675wyaEPunVdE=; b=spJko3zX5rXQWU9eV6qGtPLIIGq5NozxPV9w+UHDa1aQtf2tXBDeGd1ZNTfJzkAQwc Wij3QrtoDYl5HighqgE3Ay59pndNNPG5p9gWl0Ji/Fi8SWFNNaz5h+q3QZO2tjnBopfv kcKAVYjMKwQZEFeNMTJpQ+y8glKp/e07PoOHFWkqWp6GIVOAHrlC9Yw64eLcVl09wHG2 gZsEzIigV8VZxVz2lmxxXGGUjjquXHg3O7zyg6WZVeAiCE5jdRK0/t9e5LuIxDY0Ks2h X3RNBTq/MJzufMTlVck1tdwKQbO5GcAMAGMWtNmxNBXowPcRqKUJ8JcWuerjACHujb5k mkCg== X-Gm-Message-State: APjAAAWc70UtFJlPcEbtS71S834vpzCRn9raUw46YlXHBhHuR08lS08Z R4ANaHjPs1vUHjWnM7EYSKojNlAW X-Google-Smtp-Source: APXvYqzxaXzFEA1o0MulhgBfhT6UOr9gT5FrOpHW7KDzoU92ZUYu6VfZD656VjzhzhgXR2tzwudGEw== X-Received: by 2002:a17:90a:1a8a:: with SMTP id p10mr7866016pjp.6.1574884411178; Wed, 27 Nov 2019 11:53:31 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id 20sm16868413pgw.71.2019.11.27.11.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 11:53:30 -0800 (PST) Date: Wed, 27 Nov 2019 11:53:29 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Junio C Hamano , Jeff King Subject: [PATCH v5 11/26] t4138: stop losing return codes of git commands Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In a pipe, only the return code of the last command is used. Thus, all other commands will have their return codes masked. Rewrite pipes so that there are no git commands upstream so that we will know if a command fails. Signed-off-by: Denton Liu --- t/t4138-apply-ws-expansion.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t4138-apply-ws-expansion.sh b/t/t4138-apply-ws-expansion.sh index 3b636a63a3..b19faeb67a 100755 --- a/t/t4138-apply-ws-expansion.sh +++ b/t/t4138-apply-ws-expansion.sh @@ -17,8 +17,8 @@ test_expect_success setup ' printf "\t%s\n" 1 2 3 >after && printf "%64s\n" a b c >>after && printf "\t%s\n" 4 5 6 >>after && - git diff --no-index before after | - sed -e "s/before/test-1/" -e "s/after/test-1/" >patch1.patch && + test_expect_code 1 git diff --no-index before after >patch1.patch.raw && + sed -e "s/before/test-1/" -e "s/after/test-1/" patch1.patch.raw >patch1.patch && printf "%64s\n" 1 2 3 4 5 6 >test-1 && printf "%64s\n" 1 2 3 a b c 4 5 6 >expect-1 && @@ -33,8 +33,8 @@ test_expect_success setup ' x=$(( $x + 1 )) done && printf "\t%s\n" d e f >>after && - git diff --no-index before after | - sed -e "s/before/test-2/" -e "s/after/test-2/" >patch2.patch && + test_expect_code 1 git diff --no-index before after >patch2.patch.raw && + sed -e "s/before/test-2/" -e "s/after/test-2/" patch2.patch.raw >patch2.patch && printf "%64s\n" a b c d e f >test-2 && printf "%64s\n" a b c >expect-2 && x=1 && @@ -56,8 +56,8 @@ test_expect_success setup ' x=$(( $x + 1 )) done && printf "\t%s\n" d e f >>after && - git diff --no-index before after | - sed -e "s/before/test-3/" -e "s/after/test-3/" >patch3.patch && + test_expect_code 1 git diff --no-index before after >patch3.patch.raw && + sed -e "s/before/test-3/" -e "s/after/test-3/" patch3.patch.raw >patch3.patch && printf "%64s\n" a b c d e f >test-3 && printf "%64s\n" a b c >expect-3 && x=0 && @@ -84,8 +84,8 @@ test_expect_success setup ' printf "\t%02d\n" $x >>after x=$(( $x + 1 )) done && - git diff --no-index before after | - sed -e "s/before/test-4/" -e "s/after/test-4/" >patch4.patch && + test_expect_code 1 git diff --no-index before after >patch4.patch.raw && + sed -e "s/before/test-4/" -e "s/after/test-4/" patch4.patch.raw >patch4.patch && >test-4 && x=0 && while test $x -lt 50 -- 2.24.0.504.g3cd56eb17d