From patchwork Fri Nov 15 01:00:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244609 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 6E76C17E6 for ; Fri, 15 Nov 2019 01:00:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4587820725 for ; Fri, 15 Nov 2019 01:00:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NG68j9kU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727290AbfKOBAh (ORCPT ); Thu, 14 Nov 2019 20:00:37 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:38699 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbfKOBAg (ORCPT ); Thu, 14 Nov 2019 20:00:36 -0500 Received: by mail-pg1-f193.google.com with SMTP id 15so4892799pgh.5 for ; Thu, 14 Nov 2019 17:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=V6QgC7/rLpGvayXAfDKeI0CEdfefXitGVlwOpzb6H1k=; b=NG68j9kUFOToGtfF6WMvqbajj9zHsXItCGR25eFYaNTPvfKNyyMu+Jb7O5Dm7a/NEf BszeLKL6B4VA8mDhaxKvknUeXP3GQSHxMdlB+lSV95dg9Y8AQmGF1YZkdIt+aLaFa5QL AldEe+FuD9jnl+75MBjrh51928WArAXzOQqc7pWkYiaKGXJX69k9yVodUzGVZd3/SzND q8O525UX79g9lMVW8pa9IM4N5yWpByQnW9Zl1+AXI8Qdp7ZBi5tzGr62NUny3485tzhP YKu/TlOLeIbGi316ZP03wHkRui8O5ziu8zEXtvCFmYtawJxxjavAWQ9YKamu8uYbtpjO Lr1Q== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=V6QgC7/rLpGvayXAfDKeI0CEdfefXitGVlwOpzb6H1k=; b=VPeJaYJCuMxez3kWygAYc4GNscpyhVb4J3v2AwoMYl7fRA6Iw/voGCGFMS/oiGRMVo K4E1ifj9nMBjn4pLZOwqPdpZd6AAaV6noJfYxQfmtNhiuZllMVctpElwCfgxUyH4mWM3 XpY0Hj9eEmqXvg1bcvERkj117sbshL3daHxIMNO76I+BpxHqF+NSqnC2f4w2XP7l+aMA PGBt47k+bBSWlDFXYe0POcWz9j6BYmX/4MnWMhrLIEiF0ROr3LPsyst4yan7JO+uYMzY yaqkCLux1rulA6RmDn3J/sQSBrp3bO4yKOd/upcmAV7jmvPWrEQHHXYjpmrG4Vxs0wts sH0Q== X-Gm-Message-State: APjAAAU7P6RE0Abhc77Q0OMeSVnNJ/leE3ewH4KWq8ExBcm3c1CUGq2m CochyZC93KA4rFRh1CW9PVaC8r/j X-Google-Smtp-Source: APXvYqz/uCwvGnHE/qZgDtQ4jwY+4PYegspcrn/25tJbuLYPvCmqK2zbl8TWMACN0je+uQCh3OGMPg== X-Received: by 2002:aa7:961d:: with SMTP id q29mr13763207pfg.89.1573779635289; Thu, 14 Nov 2019 17:00:35 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id g3sm7521438pfo.82.2019.11.14.17.00.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:34 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:33 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 01/27] lib-bash.sh: move `then` onto its own line Message-ID: References: MIME-Version: 1.0 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 The code style for tests is to have statements on their own line if possible. Move the `then` onto its own line so that it conforms with the test style. Signed-off-by: Denton Liu --- t/lib-bash.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/lib-bash.sh b/t/lib-bash.sh index 2be955fafb..6a2c21cd24 100644 --- a/t/lib-bash.sh +++ b/t/lib-bash.sh @@ -2,7 +2,8 @@ # to run under Bash; primarily intended for tests of the completion # script. -if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then +if test -n "$BASH" && test -z "$POSIXLY_CORRECT" +then # we are in full-on bash mode true elif type bash >/dev/null 2>&1; then From patchwork Fri Nov 15 01:00:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244611 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 954DA930 for ; Fri, 15 Nov 2019 01:00:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7643820725 for ; Fri, 15 Nov 2019 01:00:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oyVre4KK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727298AbfKOBAk (ORCPT ); Thu, 14 Nov 2019 20:00:40 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:42735 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbfKOBAk (ORCPT ); Thu, 14 Nov 2019 20:00:40 -0500 Received: by mail-pg1-f196.google.com with SMTP id q17so4880299pgt.9 for ; Thu, 14 Nov 2019 17:00:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8PgldK2X+AFBEMRzZbMBf6HT7UkXJQqOdunZdbHKwXI=; b=oyVre4KK9P2hI/6KCgeqyexVza0doxZhIEV+lLv8qaNHiOnTVL9IYykcj1GG+ahqrQ m5xrHyrgVQf91ZMnrNSS/hL6rxY2qh8zZ7gDWwEXmj7DchJPAjTkSWpqSAg0kVyE8abX PpxMO9SZoTQDabWmERgoppcc5ZMfQe6lGS41S7nlah1yWpWiu0mIXmz+O9yjwy9oFW6q VaxNEhlYInWBTMCcdarJ8mN8hWEms0dDpxb29yw+n3jH2isUHNOwi/yh0isKDtUohRj8 l1ygjQlGzCQzh3wndPhHtZ4Qv3jn+i5p7OkIg+eWIg77u12bXUnEeBPTR+vEH+Q9RxM1 d2KA== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8PgldK2X+AFBEMRzZbMBf6HT7UkXJQqOdunZdbHKwXI=; b=ItKtAKfWG18ViHqP9XGcRfUJzoO3ekaU0mmKb0qu6sUMo2nWdJiMQMTKF9h/vuUrQg l8EEGXnOoWFu7dm8VPkB021g64AP/+58uo5ZrMuBmTHnjHvp8FWqNYFIySOSnCBNbPNo zRXSgViDQ2dX7Ko6evpo+uuwhCRZfr9+JZnjrqspoNu+5UDSS6iA2BSX1Np/WxIOBohs qsA0OiRZw0DCi7sCGOaoRLwPuS56kc/eBwHnPp+5dTfLBcOvb9/lB0a1d28N5xBfwoOF QQ/ToBn/AJ1p4SbtRUoUa3hDnMAWGYkIDT5yMRKGuZ0wQr7Ler1TqCeFyvVPvDEIgjsR Afdg== X-Gm-Message-State: APjAAAX8O52N8L5esKxXXZwWHTYfSnnHw2Mk+4HYJCv6jCQU3IqoQq9W 0myhq5QbwrW3603KXTN/VCg1YLus X-Google-Smtp-Source: APXvYqygQ1bTmk4WR3BXBsV1Tp6knO1pb25mVXnfi784InMWigj2PZVZW2AflGjzrU67tii4HKc3ng== X-Received: by 2002:a63:ec50:: with SMTP id r16mr13317585pgj.284.1573779637450; Thu, 14 Nov 2019 17:00:37 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id f7sm9585003pfa.150.2019.11.14.17.00.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:37 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:35 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 02/27] t0014: remove git command upstream of pipe Message-ID: References: MIME-Version: 1.0 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 Before, the `git frotz` command would fail but its return code was hidden since it was in the upstream of a pipe. Break the pipeline into two commands so that the return code is no longer lost. Also, mark `git frotz` with test_must_fail since it's supposed to fail. Signed-off-by: Denton Liu --- t/t0014-alias.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t0014-alias.sh b/t/t0014-alias.sh index 2694c81afd..8d3d9144c0 100755 --- a/t/t0014-alias.sh +++ b/t/t0014-alias.sh @@ -38,8 +38,8 @@ test_expect_success 'looping aliases - internal execution' ' #' test_expect_success 'run-command formats empty args properly' ' - GIT_TRACE=1 git frotz a "" b " " c 2>&1 | - sed -ne "/run_command:/s/.*trace: run_command: //p" >actual && + test_must_fail env GIT_TRACE=1 git frotz a "" b " " c 2>actual.raw && + sed -ne "/run_command:/s/.*trace: run_command: //p" actual.raw >actual && echo "git-frotz a '\'''\'' b '\'' '\'' c" >expect && test_cmp expect actual ' From patchwork Fri Nov 15 01:00: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: 11244613 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 BCEB517EF for ; Fri, 15 Nov 2019 01:00:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D4D220725 for ; Fri, 15 Nov 2019 01:00:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jVyi0pCj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727310AbfKOBAn (ORCPT ); Thu, 14 Nov 2019 20:00:43 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42773 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfKOBAn (ORCPT ); Thu, 14 Nov 2019 20:00:43 -0500 Received: by mail-pf1-f193.google.com with SMTP id s5so5456833pfh.9 for ; Thu, 14 Nov 2019 17:00:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=F/bLStvcYy0901zEyhVmOpN+BfvGp1kwoHmdZ00JNG0=; b=jVyi0pCjdq719gLKKe0d1GzWrx7lKBNOv0A6x/GXg//99PhTa/iJ6lgnd900pNf5+d Pt+g2M4DlYMShsvykgBZy9zb/uM7wrMhP3NdvFyCzWYWKkK8TeHR9SWeYwibzU6iCHHW vYecnKFBwoO0nJXeTXAu40Y8Xmrguus75qFHZAEH5Q5woPq2DqDfPQIqoXblty2jO53y xrk94+Vniw76B+by0/1hjXgxp5/oOgLxIyL8OfwHjpSFczFxpN3HyJIlG35tvN91BHge gKGhUPx6Q55ngpgJDXbItoYJ06X9UM+sKQVQ/y1Apm00l+6AbdrO2zbl3acQYWc4eRM3 0k7A== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=F/bLStvcYy0901zEyhVmOpN+BfvGp1kwoHmdZ00JNG0=; b=FTJgA1hBewWJMZ18xwTODT+dQjZw99VUv9QMNI6tCCpCuwTRQudrmnZr/1YI68+Hh+ uxkQa8DAwHcA8Ophdf5mM/3zBWhted6dIr9UgSob2NPXn0XydG1aTdNrOERhWl6l26SF uOhZ3jganRwqCFmZInTzteLJ0OXpaeSds+BwfA+u2z+8AiXhLEREtTBVP68C7jQOaDIN 4tZkA5UnjDOctvZRMWWONPx/WUl4YyOYwV7D3PFhbz5yY5CBK81ySpcYn+7R466Ez3Ex 3s1CqjOT9PIsta9IL2gtprf3Oji7h9Miex244bVS8e78muMur6YIrGHw/Lf3mwLjMuvd lGZA== X-Gm-Message-State: APjAAAVfACSe75z4YFJqVR/5e49oyqz/h9p7dd8pnU9+NAOhQn5dRydN IMhkCuA+Rold58HOujreQIHWVgni X-Google-Smtp-Source: APXvYqxOJuTvUp4bD4vsSMbNeER4BXgM/Yfad5sxavGiLv4t8gzdaQhb/EwBZLnjGuaThQ6RbC993w== X-Received: by 2002:aa7:9618:: with SMTP id q24mr14511894pfg.229.1573779640567; Thu, 14 Nov 2019 17:00:40 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id a23sm7293207pjv.26.2019.11.14.17.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:40 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:37 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 03/27] t0090: stop losing return codes of git commands Message-ID: References: MIME-Version: 1.0 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 generate_expected_cache_tree_rec(), there are currently two instances of `git ls-files` in the upstream of a pipe. In the case where the upstream git command fails, its return code will be lost. Extract the `git ls-files` into its own call so that if it ever fails, its return code is not lost. Signed-off-by: Denton Liu --- t/t0090-cache-tree.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index ce9a4a5f32..5a633690bf 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -21,9 +21,10 @@ generate_expected_cache_tree_rec () { parent="$2" && # ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux # We want to count only foo because it's the only direct child - subtrees=$(git ls-files|grep /|cut -d / -f 1|uniq) && + git ls-files >files && + subtrees=$(grep / files|cut -d / -f 1|uniq) && subtree_count=$(echo "$subtrees"|awk -v c=0 '$1 != "" {++c} END {print c}') && - entries=$(git ls-files|wc -l) && + entries=$(wc -l X-Patchwork-Id: 11244615 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 ED1B417E8 for ; Fri, 15 Nov 2019 01:00:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C53AF20725 for ; Fri, 15 Nov 2019 01:00:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tIaBjh1+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727319AbfKOBAp (ORCPT ); Thu, 14 Nov 2019 20:00:45 -0500 Received: from mail-pf1-f182.google.com ([209.85.210.182]:46511 "EHLO mail-pf1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfKOBAo (ORCPT ); Thu, 14 Nov 2019 20:00:44 -0500 Received: by mail-pf1-f182.google.com with SMTP id 193so5446255pfc.13 for ; Thu, 14 Nov 2019 17:00:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JUH6+TMebbEMxHDYm5pZuCrtpiDzloJya9DXjMJTS9A=; b=tIaBjh1+7052ATLV2W4DCGhVh4vtA3i0kkg5BNUlGD+qJcd1Pm80UL4fiOqMxV7rjK JAY42ctzHh6QrP0jTs4/LCKc1lZ371UoTm+OT+f3aY7Xo3+/TP5NWNCQwmijx13vjkMy ON9EJcXH/hmgj6auGJhbugcMHn0ZkSWFY8ukNbFIASCksjdFdLgiAlVt0rwRRxvnefSZ KtY8maI8bBdxJqgLKPHnV7Hl0rd+1pJgG9c2T2+zUyhyHt5cKVTAUvdeoasdgeQ9jE8L 9TJe6KSlzZ2fnBnSyDuOS3lr9EhfAEOFdWdbGh0qH+8nbitlkpWyqDsLDe4UzvoaLbv3 7Wjw== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JUH6+TMebbEMxHDYm5pZuCrtpiDzloJya9DXjMJTS9A=; b=gmNX4n8jj5Lc6BvuQ9aRjxs7U9ISm1zw3Mhz4x9tv7tkmJe8lCZLxRSUWRViJk7Sdt Ly6Ng9hQ8JCRU4/yGq1rMGItkum6chGkp29oMSXAQp0hoXQAGqP/AgppWp7UfrHQuDU6 iUcqkzr9uhWltqRc1BOaE/mohszcNiiEkKzFECVfNBgkdWnS5+i0/9r5kQpALZQ4Eo4C lQNo1ufxVclPs/k3E0teXv8rhBi1egmshJkkr7jxPr/Q/o6dKZZiSzRbUd7MkjvWU3dj DMyvgpDPI7vIV7NrmU3fA/adsGNcx0vkV0ZvYhmteYys5JYjvUOCIZeXhUvogLLi/hph Alew== X-Gm-Message-State: APjAAAUKOYeQ6XX09cT5ioQpcaletyCJdWWATatpUM6D1kzRdhClNLuz 7E55US8hiqeMv+Y94IsS9nqefq7K X-Google-Smtp-Source: APXvYqxfb8rDhL7ICy4eknLg+/C70GdyWhC94quH7W7dOXMl5zVKje63/OQlR4P+c3E0MVwaruLp3g== X-Received: by 2002:a62:a50a:: with SMTP id v10mr13877736pfm.222.1573779642902; Thu, 14 Nov 2019 17:00:42 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id w27sm7340022pgc.20.2019.11.14.17.00.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:42 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:40 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 04/27] t3301: stop losing return codes of git commands Message-ID: References: MIME-Version: 1.0 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 Currently, there are two ways where the return codes of git commands are lost. The first way is when a command is in the upstream of a pipe. 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. The other way is when a command is in a non-assignment command substitution. The return code will be lost in favour of the surrounding command's. Rewrite instances of this so that git commands are either run on their own or in an assignment-only command substitution. This patch fixes a real buggy test: in 'copy note with "git notes copy"', `git notes` was mistyped as `git note`. Signed-off-by: Denton Liu --- t/t3301-notes.sh | 230 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 163 insertions(+), 67 deletions(-) diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index d66a5f6faa..8f43303007 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -54,7 +54,9 @@ test_expect_success 'create notes' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - test "b4" = "$(git notes show)" && + echo b4 >expect && + git notes show >actual && + test_cmp expect actual && git show HEAD^ && test_must_fail git notes show HEAD^ ' @@ -79,14 +81,21 @@ test_expect_success 'edit existing notes' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - test "b3" = "$(git notes show)" && + echo b3 >expect && + git notes show >actual && + test_cmp expect actual && git show HEAD^ && test_must_fail git notes show HEAD^ ' test_expect_success 'show notes from treeish' ' - test "b3" = "$(git notes --ref commits^{tree} show)" && - test "b4" = "$(git notes --ref commits@{1} show)" + echo b3 >expect && + git notes --ref commits^{tree} show >actual && + test_cmp expect actual && + + echo b4 >expect && + git notes --ref commits@{1} show >actual && + test_cmp expect actual ' test_expect_success 'cannot edit notes from non-ref' ' @@ -99,7 +108,9 @@ test_expect_success 'cannot "git notes add -m" where notes already exists' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - test "b3" = "$(git notes show)" && + echo b3 >expect && + git notes show >actual && + test_cmp expect actual && git show HEAD^ && test_must_fail git notes show HEAD^ ' @@ -109,7 +120,9 @@ test_expect_success 'can overwrite existing note with "git notes add -f -m"' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - test "b1" = "$(git notes show)" && + echo b1 >expect && + git notes show >actual && + test_cmp expect actual && git show HEAD^ && test_must_fail git notes show HEAD^ ' @@ -119,7 +132,9 @@ test_expect_success 'add w/no options on existing note morphs into edit' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - test "b2" = "$(git notes show)" && + echo b2 >expect && + git notes show >actual && + test_cmp expect actual && git show HEAD^ && test_must_fail git notes show HEAD^ ' @@ -129,7 +144,9 @@ test_expect_success 'can overwrite existing note with "git notes add -f"' ' test_path_is_missing .git/NOTES_EDITMSG && git ls-tree -r refs/notes/commits >actual && test_line_count = 1 actual && - test "b1" = "$(git notes show)" && + echo b1 >expect && + git notes show >actual && + test_cmp expect actual && git show HEAD^ && test_must_fail git notes show HEAD^ ' @@ -146,7 +163,8 @@ test_expect_success 'show notes' ' Notes: ${indent}b1 EOF - ! (git cat-file commit HEAD | grep b1) && + git cat-file commit HEAD >commits && + ! grep b1 commits && git log -1 >actual && test_cmp expect actual ' @@ -472,9 +490,11 @@ test_expect_success 'removing with --stdin --ignore-missing' ' test_expect_success 'list notes with "git notes list"' ' commit_2=$(git rev-parse 2nd) && commit_3=$(git rev-parse 3rd) && + note_2=$(git rev-parse refs/notes/commits:$commit_2) && + note_3=$(git rev-parse refs/notes/commits:$commit_3) && sort -t" " -k2 >expect <<-EOF && - $(git rev-parse refs/notes/commits:$commit_2) $commit_2 - $(git rev-parse refs/notes/commits:$commit_3) $commit_3 + $note_2 $commit_2 + $note_3 $commit_3 EOF git notes list >actual && test_cmp expect actual @@ -486,9 +506,7 @@ test_expect_success 'list notes with "git notes"' ' ' test_expect_success 'list specific note with "git notes list "' ' - cat >expect <<-EOF && - $(git rev-parse refs/notes/commits:$commit_3) - EOF + git rev-parse refs/notes/commits:$commit_3 >expect && git notes list HEAD^^ >actual && test_cmp expect actual ' @@ -512,10 +530,11 @@ test_expect_success 'append to existing note with "git notes append"' ' test_expect_success '"git notes list" does not expand to "git notes list HEAD"' ' commit_5=$(git rev-parse 5th) && + note_5=$(git rev-parse refs/notes/commits:$commit_5) && sort -t" " -k2 >expect_list <<-EOF && - $(git rev-parse refs/notes/commits:$commit_2) $commit_2 - $(git rev-parse refs/notes/commits:$commit_3) $commit_3 - $(git rev-parse refs/notes/commits:$commit_5) $commit_5 + $note_2 $commit_2 + $note_3 $commit_3 + $note_5 $commit_5 EOF git notes list >actual && test_cmp expect_list actual @@ -721,7 +740,8 @@ test_expect_success 'Allow notes on non-commits (trees, blobs, tags)' ' git notes show HEAD: >actual && test_cmp expect actual && echo "Note on a blob" >expect && - filename=$(git ls-tree --name-only HEAD | head -n1) && + git ls-tree --name-only HEAD >files && + filename=$(head -n1 files) && git notes add -m "Note on a blob" HEAD:$filename && git notes show HEAD:$filename >actual && test_cmp expect actual && @@ -745,10 +765,13 @@ test_expect_success 'create note from other note with "git notes add -C"' ' Notes: ${indent}order test EOF - git notes add -C $(git notes list HEAD^) && + note=$(git notes list HEAD^) && + git notes add -C $note && git log -1 >actual && test_cmp expect actual && - test "$(git notes list HEAD)" = "$(git notes list HEAD^)" + git notes list HEAD^ >expect && + git notes list HEAD >actual && + test_cmp expect actual ' test_expect_success 'create note from non-existing note with "git notes add -C" fails' ' @@ -777,11 +800,12 @@ test_expect_success 'create note from blob with "git notes add -C" reuses blob i Notes: ${indent}This is a blob object EOF - blob=$(echo "This is a blob object" | git hash-object -w --stdin) && - git notes add -C $blob && + echo "This is a blob object" | git hash-object -w --stdin >blob && + git notes add -C $(cat blob) && git log -1 >actual && test_cmp expect actual && - test "$(git notes list HEAD)" = "$blob" + git notes list HEAD >actual && + test_cmp blob actual ' test_expect_success 'create note from other note with "git notes add -c"' ' @@ -797,7 +821,8 @@ test_expect_success 'create note from other note with "git notes add -c"' ' Notes: ${indent}yet another note EOF - MSG="yet another note" git notes add -c $(git notes list HEAD^^) && + note=$(git notes list HEAD^^) && + MSG="yet another note" git notes add -c $note && git log -1 >actual && test_cmp expect actual ' @@ -822,7 +847,8 @@ test_expect_success 'append to note from other note with "git notes append -C"' ${indent} ${indent}yet another note EOF - git notes append -C $(git notes list HEAD^) HEAD^ && + note=$(git notes list HEAD^) && + git notes append -C $note HEAD^ && git log -1 HEAD^ >actual && test_cmp expect actual ' @@ -839,7 +865,8 @@ test_expect_success 'create note from other note with "git notes append -c"' ' Notes: ${indent}other note EOF - MSG="other note" git notes append -c $(git notes list HEAD^) && + note=$(git notes list HEAD^) && + MSG="other note" git notes append -c $note && git log -1 >actual && test_cmp expect actual ' @@ -858,7 +885,8 @@ test_expect_success 'append to note from other note with "git notes append -c"' ${indent} ${indent}yet another note EOF - MSG="yet another note" git notes append -c $(git notes list HEAD) && + note=$(git notes list HEAD) && + MSG="yet another note" git notes append -c $note && git log -1 >actual && test_cmp expect actual ' @@ -878,7 +906,9 @@ test_expect_success 'copy note with "git notes copy"' ' git notes copy 8th 4th && git log 3rd..4th >actual && test_cmp expect actual && - test "$(git note list 4th)" = "$(git note list 8th)" + git notes list 4th >expect && + git notes list 8th >actual && + test_cmp expect actual ' test_expect_success 'copy note with "git notes copy" with default' ' @@ -899,14 +929,30 @@ test_expect_success 'copy note with "git notes copy" with default' ' git notes copy HEAD^ && git log -1 >actual && test_cmp expect actual && - test "$(git notes list HEAD)" = "$(git notes list HEAD^)" + git notes list HEAD^ >expect && + git notes list HEAD >actual && + test_cmp expect actual ' test_expect_success 'prevent overwrite with "git notes copy"' ' test_must_fail git notes copy HEAD~2 HEAD && + cat >expect <<-EOF && + commit $commit + Author: A U Thor + Date: Thu Apr 7 15:23:13 2005 -0700 + + ${indent}11th + + Notes: + ${indent}other note + ${indent} + ${indent}yet another note + EOF git log -1 >actual && test_cmp expect actual && - test "$(git notes list HEAD)" = "$(git notes list HEAD^)" + git notes list HEAD^ >expect && + git notes list HEAD >actual && + test_cmp expect actual ' test_expect_success 'allow overwrite with "git notes copy -f"' ' @@ -924,7 +970,9 @@ test_expect_success 'allow overwrite with "git notes copy -f"' ' git notes copy -f HEAD~3 HEAD && git log -1 >actual && test_cmp expect actual && - test "$(git notes list HEAD)" = "$(git notes list HEAD~3)" + git notes list HEAD~3 >expect && + git notes list HEAD >actual && + test_cmp expect actual ' test_expect_success 'allow overwrite with "git notes copy -f" with default' ' @@ -944,7 +992,9 @@ test_expect_success 'allow overwrite with "git notes copy -f" with default' ' git notes copy -f HEAD~2 && git log -1 >actual && test_cmp expect actual && - test "$(git notes list HEAD)" = "$(git notes list HEAD~2)" + git notes list HEAD~2 >expect && + git notes list HEAD >actual && + test_cmp expect actual ' test_expect_success 'cannot copy note from object without notes' ' @@ -979,13 +1029,21 @@ test_expect_success 'git notes copy --stdin' ' ${indent} ${indent}yet another note EOF - (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^) && - echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) | - git notes copy --stdin && + from=$(git rev-parse HEAD~3) && + to=$(git rev-parse HEAD^) && + echo "$from" "$to" >copy && + from=$(git rev-parse HEAD~2) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >>copy && + git notes copy --stdin actual && test_cmp expect actual && - test "$(git notes list HEAD)" = "$(git notes list HEAD~2)" && - test "$(git notes list HEAD^)" = "$(git notes list HEAD~3)" + git notes list HEAD~2 >expect && + git notes list HEAD >actual && + test_cmp expect actual && + git notes list HEAD~3 >expect && + git notes list HEAD^ >actual && + test_cmp expect actual ' test_expect_success 'git notes copy --for-rewrite (unconfigured)' ' @@ -1006,9 +1064,13 @@ test_expect_success 'git notes copy --for-rewrite (unconfigured)' ' ${indent}14th EOF - (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^) && - echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) | - git notes copy --for-rewrite=foo && + from=$(git rev-parse HEAD~3) && + to=$(git rev-parse HEAD^) && + echo "$from" "$to" >copy && + from=$(git rev-parse HEAD~2) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >>copy && + git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1041,17 +1103,23 @@ test_expect_success 'git notes copy --for-rewrite (enabled)' ' EOF test_config notes.rewriteMode overwrite && test_config notes.rewriteRef "refs/notes/*" && - (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^) && - echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) | - git notes copy --for-rewrite=foo && + from=$(git rev-parse HEAD~3) && + to=$(git rev-parse HEAD^) && + echo "$from" "$to" >copy && + from=$(git rev-parse HEAD~2) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >>copy && + git notes copy --for-rewrite=foo actual && test_cmp expect actual ' test_expect_success 'git notes copy --for-rewrite (disabled)' ' test_config notes.rewrite.bar false && - echo $(git rev-parse HEAD~3) $(git rev-parse HEAD) | - git notes copy --for-rewrite=bar && + from=$(git rev-parse HEAD~3) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >copy && + git notes copy --for-rewrite=bar actual && test_cmp expect actual ' @@ -1071,8 +1139,10 @@ test_expect_success 'git notes copy --for-rewrite (overwrite)' ' git notes add -f -m"a fresh note" HEAD^ && test_config notes.rewriteMode overwrite && test_config notes.rewriteRef "refs/notes/*" && - echo $(git rev-parse HEAD^) $(git rev-parse HEAD) | - git notes copy --for-rewrite=foo && + from=$(git rev-parse HEAD^) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >copy && + git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1080,8 +1150,10 @@ test_expect_success 'git notes copy --for-rewrite (overwrite)' ' test_expect_success 'git notes copy --for-rewrite (ignore)' ' test_config notes.rewriteMode ignore && test_config notes.rewriteRef "refs/notes/*" && - echo $(git rev-parse HEAD^) $(git rev-parse HEAD) | - git notes copy --for-rewrite=foo && + from=$(git rev-parse HEAD^) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >copy && + git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1103,8 +1175,10 @@ test_expect_success 'git notes copy --for-rewrite (append)' ' git notes add -f -m"another fresh note" HEAD^ && test_config notes.rewriteMode concatenate && test_config notes.rewriteRef "refs/notes/*" && - echo $(git rev-parse HEAD^) $(git rev-parse HEAD) | - git notes copy --for-rewrite=foo && + from=$(git rev-parse HEAD^) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >copy && + git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1131,9 +1205,13 @@ test_expect_success 'git notes copy --for-rewrite (append two to one)' ' git notes add -f -m"append 2" HEAD^^ && test_config notes.rewriteMode concatenate && test_config notes.rewriteRef "refs/notes/*" && - (echo $(git rev-parse HEAD^) $(git rev-parse HEAD) && - echo $(git rev-parse HEAD^^) $(git rev-parse HEAD)) | - git notes copy --for-rewrite=foo && + from=$(git rev-parse HEAD^) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >copy && + from=$(git rev-parse HEAD^^) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >>copy && + git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1142,8 +1220,10 @@ test_expect_success 'git notes copy --for-rewrite (append empty)' ' git notes remove HEAD^ && test_config notes.rewriteMode concatenate && test_config notes.rewriteRef "refs/notes/*" && - echo $(git rev-parse HEAD^) $(git rev-parse HEAD) | - git notes copy --for-rewrite=foo && + from=$(git rev-parse HEAD^) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >copy && + git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1163,8 +1243,10 @@ test_expect_success 'GIT_NOTES_REWRITE_MODE works' ' test_config notes.rewriteMode concatenate && test_config notes.rewriteRef "refs/notes/*" && git notes add -f -m"replacement note 1" HEAD^ && - echo $(git rev-parse HEAD^) $(git rev-parse HEAD) | - GIT_NOTES_REWRITE_MODE=overwrite git notes copy --for-rewrite=foo && + from=$(git rev-parse HEAD^) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >copy && + GIT_NOTES_REWRITE_MODE=overwrite git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1184,9 +1266,11 @@ test_expect_success 'GIT_NOTES_REWRITE_REF works' ' git notes add -f -m"replacement note 2" HEAD^ && test_config notes.rewriteMode overwrite && test_unconfig notes.rewriteRef && - echo $(git rev-parse HEAD^) $(git rev-parse HEAD) | + from=$(git rev-parse HEAD^) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >copy && GIT_NOTES_REWRITE_REF=refs/notes/commits:refs/notes/other \ - git notes copy --for-rewrite=foo && + git notes copy --for-rewrite=foo actual && test_cmp expect actual ' @@ -1195,9 +1279,11 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' ' git notes add -f -m"replacement note 3" HEAD^ && test_config notes.rewriteMode overwrite && test_config notes.rewriteRef refs/notes/other && - echo $(git rev-parse HEAD^) $(git rev-parse HEAD) | + from=$(git rev-parse HEAD^) && + to=$(git rev-parse HEAD) && + echo "$from" "$to" >copy && GIT_NOTES_REWRITE_REF=refs/notes/commits \ - git notes copy --for-rewrite=foo && + git notes copy --for-rewrite=foo actual && grep "replacement note 3" actual ' @@ -1212,26 +1298,36 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' ' test_expect_success 'git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' ' test_unconfig core.notesRef && sane_unset GIT_NOTES_REF && - test "$(git notes --ref=refs/heads/master get-ref)" = "refs/notes/refs/heads/master" + echo refs/notes/refs/heads/master >expect && + git notes --ref=refs/heads/master get-ref >actual && + test_cmp expect actual ' test_expect_success 'git notes get-ref (no overrides)' ' test_unconfig core.notesRef && sane_unset GIT_NOTES_REF && - test "$(git notes get-ref)" = "refs/notes/commits" + echo refs/notes/commits >expect && + git notes get-ref >actual && + test_cmp expect actual ' test_expect_success 'git notes get-ref (core.notesRef)' ' test_config core.notesRef refs/notes/foo && - test "$(git notes get-ref)" = "refs/notes/foo" + echo refs/notes/foo >expect && + git notes get-ref >actual && + test_cmp expect actual ' test_expect_success 'git notes get-ref (GIT_NOTES_REF)' ' - test "$(GIT_NOTES_REF=refs/notes/bar git notes get-ref)" = "refs/notes/bar" + echo refs/notes/bar >expect && + GIT_NOTES_REF=refs/notes/bar git notes get-ref >actual && + test_cmp expect actual ' test_expect_success 'git notes get-ref (--ref)' ' - test "$(GIT_NOTES_REF=refs/notes/bar git notes --ref=baz get-ref)" = "refs/notes/baz" + echo refs/notes/baz >expect && + GIT_NOTES_REF=refs/notes/bar git notes --ref=baz get-ref >actual && + test_cmp expect actual ' test_expect_success 'setup testing of empty notes' ' From patchwork Fri Nov 15 01:00: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: 11244617 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 1FED4138C for ; Fri, 15 Nov 2019 01:00:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 00F5F20725 for ; Fri, 15 Nov 2019 01:00:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="duawqXSH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727325AbfKOBAq (ORCPT ); Thu, 14 Nov 2019 20:00:46 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:45911 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfKOBAq (ORCPT ); Thu, 14 Nov 2019 20:00:46 -0500 Received: by mail-pl1-f194.google.com with SMTP id w7so3474854plz.12 for ; Thu, 14 Nov 2019 17:00:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=va5s/jFKOWqwfeoMlltpCInP6DHwg4Xyhf0/vxkC7Bo=; b=duawqXSHSCPm06ux5AmK4wBcKGEqS7GiurzGvWYevarzXR/mfmoSR6cBXiyE3k2NV9 ahXiCDYfW39Nbbl+/e3BaOVpuAULw8V20MfzaaQMORgzQmVRhInqBAAOkC2riTaE07SU sN7eC9ovGp949LSaB8JaHcV/ex8P5G2s7/CwWagdGfmnntuUJ+FmuHITjnfMjR4/ZTfw RZyZ3oK2osHlJzpqJ8sAJp0WkPC0e5ahgPf9o/6KOmvEyCsxUR9jJ8xnbBZTKAwQjFMI JKSGP6+mPRJL1/BvMT3Ncx1fmLO3bWdCFfRzGR8KH5p78P4urPyNstcQDNbMiEOx0r3O HaFg== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=va5s/jFKOWqwfeoMlltpCInP6DHwg4Xyhf0/vxkC7Bo=; b=S51D8ajSscHLI9dQEg32m80PLu9vmWLP6ZQ4F7il8uLoU8/nSqxSyEH1RxkvzlLfQ4 iOutIl5ogHIhrD7IMyGCEfYWuqVH5QxaDMSGf562grtJw+XLyzhEXbvTEVzyXuPCYjmU 4l6Hv92NJFIsloGTzkPcVJE/RqtxwCRs0sxhPrp8jB1Q1JXfy51VTiH5tGvCYaKp98IB m/tNDib3kaN1UlOG3Gr9mmm0d+NEbvUZxDBP04zwUsLQAhJ02ANsQA3GbUboeFSA8Bkp e+Q4T/RuBgw0kkzCGX4uexDEwxSp6kSKIM1KAvTRnIs+HyBr+CIyNBdH086BVD2/EukJ 6OEA== X-Gm-Message-State: APjAAAV/avhWN4YiWoXhBGHgtcZa1H2UfB7254L2VMompycpvglKV+iX Po26nC20lRF+3au3aBuYRxYWdO3m X-Google-Smtp-Source: APXvYqxh42ovs83Lt5K0cxFBre7OPopvcpfUSGwkiUlc9Q4+k0sDsage/GBNQYa4WkloN8P+Qk23HQ== X-Received: by 2002:a17:902:778b:: with SMTP id o11mr12236226pll.66.1573779645038; Thu, 14 Nov 2019 17:00:45 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id x29sm8515415pfj.131.2019.11.14.17.00.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:44 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:43 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 05/27] t3600: use test_line_count() where possible Message-ID: <1767492b81a9dae3e4227f9a1952a081619ff7d3.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 Since we have a helper function that can test the number of lines in a file that gives better debugging information on failure, use test_line_count() to test the number of lines. Signed-off-by: Denton Liu --- t/t3600-rm.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 8c8cca5bfb..f6e659b7e9 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -113,9 +113,10 @@ test_expect_success '"rm" command printed' ' echo frotz >test-file && git add test-file && git commit -m "add file for rm test" && - git rm test-file >rm-output && - test $(grep "^rm " rm-output | wc -l) = 1 && - rm -f test-file rm-output && + git rm test-file >rm-output.raw && + grep "^rm " rm-output.raw >rm-output && + test_line_count = 1 rm-output && + rm -f test-file rm-output.raw rm-output && git commit -m "remove file from rm test" ' From patchwork Fri Nov 15 01:00: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: 11244619 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 475DA17E6 for ; Fri, 15 Nov 2019 01:00:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2807820725 for ; Fri, 15 Nov 2019 01:00:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SO/CqysZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727336AbfKOBAt (ORCPT ); Thu, 14 Nov 2019 20:00:49 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36408 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfKOBAs (ORCPT ); Thu, 14 Nov 2019 20:00:48 -0500 Received: by mail-pl1-f196.google.com with SMTP id d7so3491798pls.3 for ; Thu, 14 Nov 2019 17:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=AmBA5qhU9xB8o/2qxmmi2wCwnOm4tPyVjPYijs7BZYA=; b=SO/CqysZXTUSQYjoe0KWz2u4AHCtelYPy6MgzrL8ZL3ImSo6UXF/Y/xD49G8M3tffc nKUXfbKydgxpAJqMBmKWylNi0TO783iYqZTW5ntA7mbWPNpB32p8JxpakwqOOAF0utU6 gR8mNvNHLE6FrhNQySWkefKH/CXQvCPTbqqGcohAOhHvWAmP0PBmbzh5zORrp2G6jrRz g5npYVYaWTxA5aAOluLCNn7cDCwrr1EtwxpbXdpvbjaP1vbN5JvTZ7TG+N80lWwfre+/ UPZA7YGNgLlu47UVqfqlSU5ayGdzIu++Sq5D30kMDZ21GjIBzCKrrpHOhZ3Axb3ZXVOg tZVQ== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AmBA5qhU9xB8o/2qxmmi2wCwnOm4tPyVjPYijs7BZYA=; b=fR577LiMgizUWPLeIm5eCYpDNPgDSuVaEdXvTM96j8WES+yS1IJvovfrYplMR1BqiN rfWlbjLDE1toW3uKfA0cUO5dlpVkZl8/rYm3EEYySA+COWLz5ZayDDOEOKTRBjZCAQTx yRUGpqfJyJfFmGkMnG4V0CTdvD1pJFH/VpuqkBo+Js/ZeQrkXgSgSVhHP4+AZT9P/AYS ZXAyUmLs8BXjGJ69tBsz7391sg+6nvmhzc4IMFfCqfRAiy7MOjP0mPA2/9Llhh8WGyof LbBWwyvGvQIDe2MyvEgPpvIK+OMjEco40YUmcj+Lr/Qc0h9x5dlz99/KaqIwpbtklKqM LVTQ== X-Gm-Message-State: APjAAAXVi6t14ViXo71nXV3bDlHoOOcyPx6TIgGAynu7AWtMz2TUW1FU RQnYiZyj/CvbzFLhqieymnlTSOM/ X-Google-Smtp-Source: APXvYqwCWkL/skN4vbEbQMFzV5aBIJv+e05Bxznwr6vFy6ObId8ujBCXcrfCcCxIG5+Gg3q2fW6M+g== X-Received: by 2002:a17:902:5a44:: with SMTP id f4mr12317512plm.174.1573779647415; Thu, 14 Nov 2019 17:00:47 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id u3sm7930068pgp.51.2019.11.14.17.00.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:46 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:45 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 06/27] t3600: stop losing return codes of git commands Message-ID: <96872839cf50b5cdbe77b233816ffe40b02cded4.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 When a command is in a non-assignment command substitution, the return code will be lost in favour of the surrounding command's. As a result, if a git command fails, we won't know about it. Rewrite instances of this so that git commands are either run in an assignment-only command substitution so that their return codes aren't lost. Signed-off-by: Denton Liu --- t/t3600-rm.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index f6e659b7e9..0c3bf10edd 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -304,7 +304,8 @@ EOF test_expect_success 'rm removes empty submodules from work tree' ' mkdir submod && - git update-index --add --cacheinfo 160000 $(git rev-parse HEAD) submod && + hash=$(git rev-parse HEAD) && + git update-index --add --cacheinfo 160000 "$hash" submod && git config -f .gitmodules submodule.sub.url ./. && git config -f .gitmodules submodule.sub.path submod && git submodule init && @@ -623,7 +624,8 @@ test_expect_success 'setup subsubmodule' ' git submodule update && ( cd submod && - git update-index --add --cacheinfo 160000 $(git rev-parse HEAD) subsubmod && + hash=$(git rev-parse HEAD) && + git update-index --add --cacheinfo 160000 "$hash" subsubmod && git config -f .gitmodules submodule.sub.url ../. && git config -f .gitmodules submodule.sub.path subsubmod && git submodule init && From patchwork Fri Nov 15 01:00: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: 11244621 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 70AB117F0 for ; Fri, 15 Nov 2019 01:00:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F18620725 for ; Fri, 15 Nov 2019 01:00:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rDsWDV50" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727340AbfKOBAv (ORCPT ); Thu, 14 Nov 2019 20:00:51 -0500 Received: from mail-pg1-f170.google.com ([209.85.215.170]:41375 "EHLO mail-pg1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfKOBAv (ORCPT ); Thu, 14 Nov 2019 20:00:51 -0500 Received: by mail-pg1-f170.google.com with SMTP id h4so4879345pgv.8 for ; Thu, 14 Nov 2019 17:00:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JVSGvzVUpd24odLVncvJ13MZcacBm4hnOc0q7NeALPs=; b=rDsWDV50782B6YfNO+eMoDOVV7yoEmooWHHGcWzHZrbegcwib7TVuTaHO7pKGgf3PR JFQpaV6IMedB9QAIxkvtpvWMcZ9xkCzFVy1jpK4Z0mMulZiubo1CPF9MHuEQiRgIOPk0 M4RI7IFDDBRfMjrG24RwmcCEkGFknZcUkoTS+ho1X11D8ZOmbto/4pG690TdaXbYy2cn UhcNMK75VAngOxc34ati7bTGwSxhMgxls9aJlDh3MsqYA/UbpSGDq++xju15TYS0xvwV EAuQvSzqS2L9ZYs9AVn5EXAA9T7OB+ao4ajTWkN6W3TaBdnaiwZsBvntaXNbv6XNzXPF 4obg== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JVSGvzVUpd24odLVncvJ13MZcacBm4hnOc0q7NeALPs=; b=qlA+gkY2Oe7593WYpUsDt4jJRorKshL+NaiwyksbKaUN1v4KMoLp/dVeLtZPpHpA7Y oOk0n98zuDAeL9icpwLqYH53xXt1sePhk3ctyXPYnHEI48LffAYOa5UD2KH+K0eorMNB l+kBk/445v50sx5vNBVuTgIP+vLlX/nMA05/ri8TiXTHx+12ldy76HAE51W0X8Z6jQtD uqphQ+J9i/cEYV60KKCAt9/OPTJTPKdTh47vwt9RJY4S4/E9WcevYPIPP2dLgQtEx71w xf5AggxDHNLBf7/N0afwiETpAje7xbLHHnL/maeAFiboBAj+Hig6L17XCUv3UgHn0CsZ Dzjw== X-Gm-Message-State: APjAAAUemHbi4PWY9tzWFNxR3fcy3CE99mVjzricMzXT2yxDMtJDd9mg V7D+STfeZcvwrXiN5UqFiX9K1yEL X-Google-Smtp-Source: APXvYqwBGC5x29wxz/DAOq8sV5NZyyuGneEZXhBO5PTjQmNZk5s7iHFDgTZxR3B5UfNUYDK3iTpP9A== X-Received: by 2002:a63:5c4a:: with SMTP id n10mr13761438pgm.120.1573779649603; Thu, 14 Nov 2019 17:00:49 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id p9sm8184012pfq.40.2019.11.14.17.00.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:49 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:47 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 07/27] t3600: comment on inducing SIGPIPE in `git rm` Message-ID: References: MIME-Version: 1.0 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 Add a comment about intentionally inducing SIGPIPE since this is unusual and future developers should be aware. Also, even though we are trying to refactor git commands out of the upstream of pipes, we cannot do it here since we rely on it being upstream to induce SIGPIPE. Comment on that as well so that future developers do not try to change it. Signed-off-by: Denton Liu --- t/t3600-rm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 0c3bf10edd..0ea858d652 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -251,6 +251,7 @@ test_expect_success 'choking "git rm" should not let it die with cruft' ' echo "100644 $hash 0 some-file-$i" i=$(( $i + 1 )) done | git update-index --index-info && + # git command is intentionally placed upstream of pipe to induce SIGPIPE git rm -n "some-file-*" | : && test_path_is_missing .git/index.lock ' From patchwork Fri Nov 15 01:00: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: 11244625 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 5EDB717E6 for ; Fri, 15 Nov 2019 01:00:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 374BF20727 for ; Fri, 15 Nov 2019 01:00:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D0hzajHP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727345AbfKOBA4 (ORCPT ); Thu, 14 Nov 2019 20:00:56 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46072 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfKOBAz (ORCPT ); Thu, 14 Nov 2019 20:00:55 -0500 Received: by mail-pf1-f194.google.com with SMTP id z4so5449968pfn.12 for ; Thu, 14 Nov 2019 17:00:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lc83agBZRYyQyaq7Jlodkh3tF/B8joXU/DGPzO7/iR0=; b=D0hzajHP74vdDv3Tu7T04NCAoZk4wmJJRdT+Sxj4qF1Z372bCx4FzaZC/sR3f3f/FU 7cBxBLuijqBNBev9Sc47KEUMS6DytnDyneU4Pa7EBIRog8cFpPYtFvQcBn/bX0sgd9hD oE8jmX0DReri+bDn9WOsBx6MU9nbMWqdZgzBVMQRt3xA+FWJCmoy/Yf9T9kGHuV59p+W bPMquyigOA+ZjZnwM8qN/DB/Frq03ov4er7KVzUquKB215VTksQoNdgP5jTqgonoKd9h UMbJ1e4EiZcyax3KOMLOEmkazfua8ZiqsEvcoHganfVKf2kqXmjqLqEcZXHLjRKyDPYW 34cA== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lc83agBZRYyQyaq7Jlodkh3tF/B8joXU/DGPzO7/iR0=; b=RrtMZNiJiC1WPcf2NXycOawgTGGYpw3i0yyC+1tFc5sRZjSGpmUCRwTfb9N5UJy26L VdDqv5ufu6/9R5glrtenuTPL8RuzQZHJwLbBwMDwslmuFrAv0K/fOLR+IzeErtXwvsBe 71/8ogwWYxq7BesCMTz/KwknVxFsGGLkGkH868lySr6tKvN2NmIANDEiae7iAytxzrzF 38rbUTV4P0i/pGiyIxgbtIl+igh9vBqSNm7UHss9aznz9YQlKTNXCVI0OuGtHOd7FGOD gLv2F62i97hM3dKvUk2a+R0AnqOtk4FicBPm8Zvu0d1eIrf9KNCBG6MigGFrp8+g+i3v dFDg== X-Gm-Message-State: APjAAAXd13SHEq1ZfT7EC+qT0xbJkeMmI2YOjUkBP0lxX8Gp9r6e9jTV FBpEIGcbwWqoJ/QPxFmvwQEbdSJB X-Google-Smtp-Source: APXvYqxe6h+6qfH+/YtAGxQLS8U8DDcrwbVMI0DNLkoefTlk+n4BWHFoH1z7qVuEarBMUCtNfA8WvQ== X-Received: by 2002:a63:dc45:: with SMTP id f5mr10696793pgj.250.1573779652808; Thu, 14 Nov 2019 17:00:52 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id fz12sm6833139pjb.15.2019.11.14.17.00.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:52 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:49 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 08/27] t4015: stop losing return codes of git commands Message-ID: References: MIME-Version: 1.0 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 Currently, there are two ways where the return codes of git commands are lost. The first way is when a command is in the upstream of a pipe. 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. The other way is when a command is in a non-assignment command substitution. The return code will be lost in favour of the surrounding command's. Rewrite instances of this so that git commands are either run on their own or in an assignment-only command substitution. Signed-off-by: Denton Liu --- t/t4015-diff-whitespace.sh | 119 ++++++++++++++++++++++--------------- 1 file changed, 72 insertions(+), 47 deletions(-) diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index eadaf57262..7fb83c8eff 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -16,7 +16,8 @@ test_expect_success "Ray Lehtiniemi's example" ' } while (0); EOF git update-index --add x && - before=$(git rev-parse --short $(git hash-object x)) && + old_hash_x=$(git hash-object x) && + before=$(git rev-parse --short "$old_hash_x") && cat <<-\EOF >x && do @@ -25,7 +26,8 @@ test_expect_success "Ray Lehtiniemi's example" ' } while (0); EOF - after=$(git rev-parse --short $(git hash-object x)) && + new_hash_x=$(git hash-object x) && + after=$(git rev-parse --short "$new_hash_x") && cat <<-EOF >expect && diff --git a/x b/x @@ -63,7 +65,8 @@ test_expect_success 'another test, without options' ' EOF git update-index x && - before=$(git rev-parse --short $(git hash-object x)) && + old_hash_x=$(git hash-object x) && + before=$(git rev-parse --short "$old_hash_x") && tr "_" " " <<-\EOF >x && _ whitespace at beginning @@ -73,7 +76,8 @@ test_expect_success 'another test, without options' ' unchanged line CR at end EOF - after=$(git rev-parse --short $(git hash-object x)) && + new_hash_x=$(git hash-object x) && + after=$(git rev-parse --short "$new_hash_x") && tr "Q_" "\015 " <<-EOF >expect && diff --git a/x b/x @@ -526,13 +530,15 @@ test_expect_success 'ignore-blank-lines: mix changes and blank lines' ' test_expect_success 'check mixed spaces and tabs in indent' ' # This is indented with SP HT SP. echo " foo();" >x && - git diff --check | grep "space before tab in indent" + test_must_fail git diff --check >check && + grep "space before tab in indent" check ' test_expect_success 'check mixed tabs and spaces in indent' ' # This is indented with HT SP HT. echo " foo();" >x && - git diff --check | grep "space before tab in indent" + test_must_fail git diff --check >check && + grep "space before tab in indent" check ' test_expect_success 'check with no whitespace errors' ' @@ -753,20 +759,23 @@ test_expect_success 'check tab-in-indent excluded from wildcard whitespace attri test_expect_success 'line numbers in --check output are correct' ' echo "" >x && echo "foo(); " >>x && - git diff --check | grep "x:2:" + test_must_fail git diff --check >check && + grep "x:2:" check ' test_expect_success 'checkdiff detects new trailing blank lines (1)' ' echo "foo();" >x && echo "" >>x && - git diff --check | grep "new blank line" + test_must_fail git diff --check >check && + grep "new blank line" check ' test_expect_success 'checkdiff detects new trailing blank lines (2)' ' { echo a; echo b; echo; echo; } >x && git add x && { echo a; echo; echo; echo; echo; } >x && - git diff --check | grep "new blank line" + test_must_fail git diff --check >check && + grep "new blank line" check ' test_expect_success 'checkdiff allows new blank lines' ' @@ -794,14 +803,16 @@ test_expect_success 'whitespace-only changes reported across renames' ' git reset --hard && for i in 1 2 3 4 5 6 7 8 9; do echo "$i$i$i$i$i$i"; done >x && git add x && - before=$(git rev-parse --short $(git hash-object x)) && + hash_x=$(git hash-object x) && + before=$(git rev-parse --short "$hash_x") && git commit -m "base" && sed -e "5s/^/ /" x >z && git rm x && git add z && - after=$(git rev-parse --short $(git hash-object z)) && - git diff -w -M --cached | - sed -e "/^similarity index /s/[0-9][0-9]*/NUM/" >actual && + hash_z=$(git hash-object z) && + after=$(git rev-parse --short "$hash_z") && + git diff -w -M --cached >actual.raw && + sed -e "/^similarity index /s/[0-9][0-9]*/NUM/" actual.raw >actual && cat <<-EOF >expect && diff --git a/x b/z similarity index NUM% @@ -840,7 +851,8 @@ test_expect_success 'combined diff with autocrlf conversion' ' git config core.autocrlf true && test_must_fail git merge master && - git diff | sed -e "1,/^@@@/d" >actual && + git diff >actual.raw && + sed -e "1,/^@@@/d" actual.raw >actual && ! grep "^-" actual ' @@ -864,11 +876,14 @@ test_expect_success 'diff that introduces a line with only tabs' ' git config core.whitespace blank-at-eol && git reset --hard && echo "test" >x && - before=$(git rev-parse --short $(git hash-object x)) && + old_hash_x=$(git hash-object x) && + before=$(git rev-parse --short "$old_hash_x") && git commit -m "initial" x && echo "{NTN}" | tr "NT" "\n\t" >>x && - after=$(git rev-parse --short $(git hash-object x)) && - git diff --color | test_decode_color >current && + new_hash_x=$(git hash-object x) && + after=$(git rev-parse --short "$new_hash_x") && + git diff --color >current.raw && + test_decode_color current && cat >expected <<-EOF && diff --git a/x b/x @@ -891,17 +906,19 @@ test_expect_success 'diff that introduces and removes ws breakages' ' echo "0. blank-at-eol " && echo "1. blank-at-eol " } >x && - before=$(git rev-parse --short $(git hash-object x)) && + old_hash_x=$(git hash-object x) && + before=$(git rev-parse --short "$old_hash_x") && git commit -a --allow-empty -m preimage && { echo "0. blank-at-eol " && echo "1. still-blank-at-eol " && echo "2. and a new line " } >x && - after=$(git rev-parse --short $(git hash-object x)) && + new_hash_x=$(git hash-object x) && + after=$(git rev-parse --short "$new_hash_x") && - git diff --color | - test_decode_color >current && + git diff --color >current.raw && + test_decode_color current && cat >expected <<-EOF && diff --git a/x b/x @@ -925,14 +942,16 @@ test_expect_success 'ws-error-highlight test setup' ' echo "0. blank-at-eol " && echo "1. blank-at-eol " } >x && - before=$(git rev-parse --short $(git hash-object x)) && + old_hash_x=$(git hash-object x) && + before=$(git rev-parse --short "$old_hash_x") && git commit -a --allow-empty -m preimage && { echo "0. blank-at-eol " && echo "1. still-blank-at-eol " && echo "2. and a new line " } >x && - after=$(git rev-parse --short $(git hash-object x)) && + new_hash_x=$(git hash-object x) && + after=$(git rev-parse --short "$new_hash_x") && cat >expect.default-old <<-EOF && diff --git a/x b/x @@ -974,32 +993,32 @@ test_expect_success 'ws-error-highlight test setup' ' test_expect_success 'test --ws-error-highlight option' ' - git diff --color --ws-error-highlight=default,old | - test_decode_color >current && + git diff --color --ws-error-highlight=default,old >current.raw && + test_decode_color current && test_cmp expect.default-old current && - git diff --color --ws-error-highlight=all | - test_decode_color >current && + git diff --color --ws-error-highlight=all >current.raw && + test_decode_color current && test_cmp expect.all current && - git diff --color --ws-error-highlight=none | - test_decode_color >current && + git diff --color --ws-error-highlight=none >current.raw && + test_decode_color current && test_cmp expect.none current ' test_expect_success 'test diff.wsErrorHighlight config' ' - git -c diff.wsErrorHighlight=default,old diff --color | - test_decode_color >current && + git -c diff.wsErrorHighlight=default,old diff --color >current.raw && + test_decode_color current && test_cmp expect.default-old current && - git -c diff.wsErrorHighlight=all diff --color | - test_decode_color >current && + git -c diff.wsErrorHighlight=all diff --color >current.raw && + test_decode_color current && test_cmp expect.all current && - git -c diff.wsErrorHighlight=none diff --color | - test_decode_color >current && + git -c diff.wsErrorHighlight=none diff --color >current.raw && + test_decode_color current && test_cmp expect.none current ' @@ -1007,18 +1026,18 @@ test_expect_success 'test diff.wsErrorHighlight config' ' test_expect_success 'option overrides diff.wsErrorHighlight' ' git -c diff.wsErrorHighlight=none \ - diff --color --ws-error-highlight=default,old | - test_decode_color >current && + diff --color --ws-error-highlight=default,old >current.raw && + test_decode_color current && test_cmp expect.default-old current && git -c diff.wsErrorHighlight=default \ - diff --color --ws-error-highlight=all | - test_decode_color >current && + diff --color --ws-error-highlight=all >current.raw && + test_decode_color current && test_cmp expect.all current && git -c diff.wsErrorHighlight=all \ - diff --color --ws-error-highlight=none | - test_decode_color >current && + diff --color --ws-error-highlight=none >current.raw && + test_decode_color current && test_cmp expect.none current ' @@ -1038,7 +1057,8 @@ test_expect_success 'detect moved code, complete file' ' git mv test.c main.c && test_config color.diff.oldMoved "normal red" && test_config color.diff.newMoved "normal green" && - git diff HEAD --color-moved=zebra --color --no-renames | test_decode_color >actual && + git diff HEAD --color-moved=zebra --color --no-renames >actual.raw && + test_decode_color actual && cat >expected <<-EOF && diff --git a/main.c b/main.c new file mode 100644 @@ -1141,9 +1161,12 @@ test_expect_success 'detect malicious moved code, inside file' ' bar(); } EOF - after_main=$(git rev-parse --short $(git hash-object main.c)) && - after_test=$(git rev-parse --short $(git hash-object test.c)) && - git diff HEAD --no-renames --color-moved=zebra --color | test_decode_color >actual && + hash_main=$(git hash-object main.c) && + after_main=$(git rev-parse --short "$hash_main") && + hash_test=$(git hash-object test.c) && + after_test=$(git rev-parse --short "$hash_test") && + git diff HEAD --no-renames --color-moved=zebra --color >actual.raw && + test_decode_color actual && cat <<-EOF >expected && diff --git a/main.c b/main.c index $before_main..$after_main 100644 @@ -1192,7 +1215,8 @@ test_expect_success 'plain moved code, inside file' ' test_config color.diff.oldMovedAlternative "blue" && test_config color.diff.newMovedAlternative "yellow" && # needs previous test as setup - git diff HEAD --no-renames --color-moved=plain --color | test_decode_color >actual && + git diff HEAD --no-renames --color-moved=plain --color >actual.raw && + test_decode_color actual && cat <<-EOF >expected && diff --git a/main.c b/main.c index $before_main..$after_main 100644 @@ -1771,7 +1795,8 @@ test_expect_success 'move detection with submodules' ' ! grep BRED decoded_actual && # nor did we mess with it another way - git diff --submodule=diff --color | test_decode_color >expect && + git diff --submodule=diff --color >expect.raw && + test_decode_color expect && test_cmp expect decoded_actual && rm -rf bananas && git submodule deinit bananas From patchwork Fri Nov 15 01:00:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244623 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 E6441930 for ; Fri, 15 Nov 2019 01:00:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C648B20727 for ; Fri, 15 Nov 2019 01:00:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JYHtPauQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727349AbfKOBA4 (ORCPT ); Thu, 14 Nov 2019 20:00:56 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38427 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKOBA4 (ORCPT ); Thu, 14 Nov 2019 20:00:56 -0500 Received: by mail-pl1-f195.google.com with SMTP id w8so3486954plq.5 for ; Thu, 14 Nov 2019 17:00:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hSmpX/yfEXtwy3Xz4dMR7V8zySn4Hd4nOhQ9KaFJTW8=; b=JYHtPauQlBhrlKWWp8CpUj7tjC0BWz1hoVocsPFIPCOjYMFsesEYpltA4vkO57o8tF w+33H/Z0WEMAyt/buFBo9HQBrS/LTwjMIegiawPE7QTNDqBvE1OhoRZlnWzjUvBTA2g4 5MgRkRMKjXcVr5Fj8q47nshXJqkD9xtNu3aAJOBEwBaj7Gvye6SJYnY7fcV5tl8HFEQY Rz31jQhkONv+igg1ykdpjff1zM8DGUIK0Axff5GsDN9vUXiko7JGQoN2Z3ALMqUuyYmj 3RYeEmORvyz0VOVDK6xEDIMU/+uSLRzyjUOrMlRZZuptx1psjKynvAxMXNox1ZcpuHFW 66yw== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hSmpX/yfEXtwy3Xz4dMR7V8zySn4Hd4nOhQ9KaFJTW8=; b=LRIdhoe2VXJzApVad4OBEFlZhvTReQOdOh1LUAuUL7SX8Dbs9HNUxIv5zwXkgxXoyp JjMEeXhzWwoThI8THtXjPzTJScSnSk/bxdk+5xXEi0Nj8p1/ZuDpO98KCKhiECfn+vfs x2fGQQkxJAi+4aePSaWfJMLzXqdxl3BAqX7TrlKDeSBbw65To7b3ZShYQq+/ArIaI+Wa hIL8PDbIvqVoY091maKM8E9RrdXn3xAmboPQ7P6dQ/ynKk5nfOxDgbLR0WTQwiZxsr1x byWhVnabwzXIcoXG32+WeJrGbJ1jSEnQktMs+k4bT25S9nWq9XebzF2M7N7IHblO5Geu 7B1A== X-Gm-Message-State: APjAAAUsHbRZLz7jvMw2HPTo2pQwiTgZtCvw/mJM3LiKekTHCl5grc97 HVXwl1iejYoWMtAwSZ7Ze4du2gMD X-Google-Smtp-Source: APXvYqyCrHYOKodw92Hu96UqNmg2KVXZfNCf7AawD2K0JfhclpT+Hip8O7ZPKbroGOvtftcvzoV0HA== X-Received: by 2002:a17:902:ac84:: with SMTP id h4mr12719937plr.328.1573779654921; Thu, 14 Nov 2019 17:00:54 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id x2sm8184525pge.76.2019.11.14.17.00.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:54 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:53 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 09/27] t4015: use test_write_lines() Message-ID: References: MIME-Version: 1.0 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 Instead of rolling our own method to write out some lines into a file, use the existing test_write_lines(). Signed-off-by: Denton Liu --- t/t4015-diff-whitespace.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 7fb83c8eff..4c540b1d70 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -771,9 +771,9 @@ test_expect_success 'checkdiff detects new trailing blank lines (1)' ' ' test_expect_success 'checkdiff detects new trailing blank lines (2)' ' - { echo a; echo b; echo; echo; } >x && + test_write_lines a b "" "" >x && git add x && - { echo a; echo; echo; echo; echo; } >x && + test_write_lines a "" "" "" "" >x && test_must_fail git diff --check >check && grep "new blank line" check ' From patchwork Fri Nov 15 01:00:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244627 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 19F51138C for ; Fri, 15 Nov 2019 01:01:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC76720725 for ; Fri, 15 Nov 2019 01:01:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gMU33jtZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727361AbfKOBBB (ORCPT ); Thu, 14 Nov 2019 20:01:01 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46179 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKOBA6 (ORCPT ); Thu, 14 Nov 2019 20:00:58 -0500 Received: by mail-pg1-f196.google.com with SMTP id r18so4862572pgu.13 for ; Thu, 14 Nov 2019 17:00:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FfeGMNg6eFWjRHGLYhIIuUkmw5j6ckKkE2S4osRZgDc=; b=gMU33jtZt2K9zPTmRG+qcPbMIFjzFRMT88xBUiOZfs/vE4igoWV4TK9iZHMa+IzDe3 jV/xyiF95DLXFKTXsGW1cDiCB7gDech6oDlUnjnIJ/EIZ7UiIrQUpJ4R/E3Tk1yV78IU R9ysWXn6/hBlOgEe7j7RYNCDe2cNegNm97FNLggOhPvk4Lk2owQnayWwrZCiBXkkS8Zv zZnW9eYJtj+7WkgB3rLe3vYrDOObT1o8Lz/vbTQTv3FUFBPgj5+UeI6G93zYpBrFzu+c ebL6mX1VV58VKhglQU/IZiIWzaSji9cHxc5OAHMuPxvCm07pwfJQMTue2bnzx6yWa4Qs zwJg== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FfeGMNg6eFWjRHGLYhIIuUkmw5j6ckKkE2S4osRZgDc=; b=g9X6At3y+xjFaCI829sq6HYUUU33RNZ6gDR8YGDrtp3/O1V9AQaZC4rZdyvUG7ocu1 N44O8US5kJZRIJS1PnVAcB4SA0XAAbuQye6nYHs2mfYAy9Cd+anNuprXFe0xWKii6Yz9 gMWrWTNvrdWtfQ5JIBA2B5+9FLsd3/+tkLx+bAhOUEqa2MOTGWOz9K2KfOrAV1sT26s7 W5FbKnnOivaQ+Ev1mRx8w4bqUndqDz5RkaablqkPnw/A+9Jc7zVpsaKx1VpJu3qNwbMt vd6U7MN8MYp4FiYy+m0QjKPqxbx14i/T06I8dJPlkhvyvBYk9sqnb4XN1eFtygFddzlW jSig== X-Gm-Message-State: APjAAAXTF/QcEHptBlsqpF3laiuWEy3qWYWw8/zk/wiVWS1zQjKza+a/ zGxzcfZD9mj/jA07MB2cX4TfK9UU X-Google-Smtp-Source: APXvYqydAyfOW16Lm7qOzf9xmgxrmUpSYBrendWcEsL7jtul8EtsFqvlDEoIPGGoFL/6rZjD5sw3sg== X-Received: by 2002:a63:fe4d:: with SMTP id x13mr12771314pgj.82.1573779657088; Thu, 14 Nov 2019 17:00:57 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id o125sm7639775pfg.118.2019.11.14.17.00.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:56 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:55 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 10/27] t4138: stop losing return codes of git commands Message-ID: References: MIME-Version: 1.0 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..60435d6d41 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_must_fail 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_must_fail 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_must_fail 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_must_fail 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 From patchwork Fri Nov 15 01:00:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244629 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 25338930 for ; Fri, 15 Nov 2019 01:01:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 04FA820725 for ; Fri, 15 Nov 2019 01:01:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FmfPFlXU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727357AbfKOBBB (ORCPT ); Thu, 14 Nov 2019 20:01:01 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34686 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727351AbfKOBBA (ORCPT ); Thu, 14 Nov 2019 20:01:00 -0500 Received: by mail-pg1-f194.google.com with SMTP id z188so4905834pgb.1 for ; Thu, 14 Nov 2019 17:01:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=d52BVKZc/Nha/9ErbijJvvRcy8PWmhgWxHG7MHn6dN8=; b=FmfPFlXUOwWBVEnYTJZSjFIul68QHwvtI4tiwIb8ArYAWTvZNJUyCN0WGKG8pyktgG goUs0Y3mlkMVKIG7ofCFfyrSC4KcOufPMkIXAwOi51Dv83mp3gg1rF2lnVswJwtX2Pp3 qonfaifq3iPWPbHvgKdvrAfVssBD88ZaDLP0i3YegIoAEP5DHZD1WpJAPeqGbQhwwqGD v7FQiaegq/oh1OqRniIa5jfBzUKykuKDebMkZKJ1ihwWFg+3JPT+BcQUcn37Eryty6dB 6cPVQj0LGPoRfYdflEd/3KJleSeKv41lEwDDQdNKmSkudlu4k+6KlpAko34i+D32iXHx mv+A== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=d52BVKZc/Nha/9ErbijJvvRcy8PWmhgWxHG7MHn6dN8=; b=e3WpHBw/wsCQ2YUpaPXdqcYvSC/O4rm04kp6C66EAVhFwPF2bFjbeD/azyrgT//mqY lk5xBbDZ+3ZEWs8ZFEWDoQhF0FggQU3QPRZXgiYg3yDgC9cbzNHGnrc2lWFUTotZ8HG+ Z2bOIso1fClBODkuAfqnZX/5aiAY57WCbhZ2flDtN7+rrd/oNHDLcJoRFf4c35KdPJBk ewA7wv+CIBgiMYplg3el1lV1NK4fKRnPrsktkwnwTyG9C8QqhyEPW2FntVwZ36c0PfAh uGNIUcy3kL4xzEeyYMEGGL+c8R8avpFTwPcif/KqpKwLzeCEsFmM3/1x3Inc/lGe6ca0 vj3w== X-Gm-Message-State: APjAAAVnmfn8eRdUg1FuzorAgdL4aqSd4PRHeH+O+96BkpF7VIGxL8qT GiZuVVLe1laSaEJYfz6smkZXOt7c X-Google-Smtp-Source: APXvYqwL8+tyYmQqxNcNePdkvaKn0lZxNtoNPPAHBR/bSaW9lgoGVotdLXzq/k1969+s/dOh9UI0iA== X-Received: by 2002:a62:83c8:: with SMTP id h191mr4379798pfe.118.1573779659322; Thu, 14 Nov 2019 17:00:59 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id y4sm7529157pgy.27.2019.11.14.17.00.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:00:58 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:57 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 11/27] t5317: stop losing return codes of git commands Message-ID: <105f0a7a873fce4c741ffdb7bfa458a85311ac79.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 Currently, there are two ways where the return codes of git commands are lost. The first way is when a command is in the upstream of a pipe. 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. The other way is when a command is in a non-assignment command substitution. The return code will be lost in favour of the surrounding command's. Rewrite instances of this such that git commands output to a file and surrounding commands only call command substitutions with non-git commands. Signed-off-by: Denton Liu --- t/t5317-pack-objects-filter-objects.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/t/t5317-pack-objects-filter-objects.sh b/t/t5317-pack-objects-filter-objects.sh index 2d2f5d0229..a8bbad74e2 100755 --- a/t/t5317-pack-objects-filter-objects.sh +++ b/t/t5317-pack-objects-filter-objects.sh @@ -72,7 +72,8 @@ test_expect_success 'get an error for missing tree object' ' echo foo >r5/foo && git -C r5 add foo && git -C r5 commit -m "foo" && - del=$(git -C r5 rev-parse HEAD^{tree} | sed "s|..|&/|") && + git -C r5 rev-parse HEAD^{tree} >tree && + del=$(sed "s|..|&/|" tree) && rm r5/.git/objects/$del && test_must_fail git -C r5 pack-objects --revs --stdout 2>bad_tree <<-EOF && HEAD @@ -230,10 +231,9 @@ test_expect_success 'verify explicitly specifying oversized blob in input' ' awk -f print_2.awk ls_files_result | sort >expected && - git -C r2 pack-objects --revs --stdout --filter=blob:limit=1k >filter.pack <<-EOF && - HEAD - $(git -C r2 rev-parse HEAD:large.10000) - EOF + echo HEAD >objects && + git -C r2 rev-parse HEAD:large.10000 >>objects && + git -C r2 pack-objects --revs --stdout --filter=blob:limit=1k filter.pack && git -C r2 index-pack ../filter.pack && git -C r2 verify-pack -v ../filter.pack >verify_result && @@ -377,7 +377,8 @@ test_expect_success 'verify sparse:oid=OID' ' awk -f print_2.awk ls_files_result | sort >expected && - oid=$(git -C r4 ls-files -s pattern | awk -f print_2.awk) && + git -C r4 ls-files -s pattern >staged && + oid=$(awk -f print_2.awk staged) && git -C r4 pack-objects --revs --stdout --filter=sparse:oid=$oid >filter.pack <<-EOF && HEAD EOF From patchwork Fri Nov 15 01:00:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244631 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 83A7B930 for ; Fri, 15 Nov 2019 01:01:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6483D20727 for ; Fri, 15 Nov 2019 01:01:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EgdiXd4i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727368AbfKOBBE (ORCPT ); Thu, 14 Nov 2019 20:01:04 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:38210 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKOBBC (ORCPT ); Thu, 14 Nov 2019 20:01:02 -0500 Received: by mail-pf1-f193.google.com with SMTP id c13so5475796pfp.5 for ; Thu, 14 Nov 2019 17:01:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PFEvRltT5TmyfiZy9WFNgCopChrgcKm/AZMM3ekUtiY=; b=EgdiXd4iYkDjEjlkCIhsKWrkN6OEb3gjk7NoG0SApMHkQr+JiRZYcCsqyNSYnaS7YD 6sxnJrGPGdmZfqC7zl/V/zZuOYTp/ou+yl+k9vNHH3aMYKWe8/vPDwLe9KbR6Cr8JpuO n/hgXxCI7hpdcUgWSl19yHIYtkPQC8wE2z2GHzbkCe0+v2eub7WE65PZ+S6suS69Ij/0 AYS6sIIywGCctRt0V5+W0pLiuN7Z2fYfmEv5U7vW3jr5CzPf6unYNy4wu5cu2D2CnOv2 e6gcPlAUdKGWiItmFy9OwO5Hb1YCkP0XCd4BMGKtfBcIo056FjUvot5M/O/hDIy/PBQn OXiQ== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PFEvRltT5TmyfiZy9WFNgCopChrgcKm/AZMM3ekUtiY=; b=svs0t/20L5lq1ftGiulHLhIskszR3h8vKA8y+61VlqyvMhthGmUcCuHZTysXiCKP+X /N5WmqH4SL7xJpj5uPt0bTevLRnN+Pywd10eBmsZwwB9A1EMfUVBmZJwP642jyHbKH69 O97FsRKQIAw5ysGJ7dFcfdTvgeRTvC2In7SQffws2pMbexahaXiXZ+nsUbqWGo+s23Zt 42/aFO1zWI149svHai4K+2LYrac/qJvyDyULceBj/EB7mwrcs7gWdbmezj/zRd3RLSLP eJB2PM+L8dxS+2CuRJdPvltrvESYrHwbxGxOflmHqsZ5k1xJRCMz7DqgKShrh6sXN+84 qVPg== X-Gm-Message-State: APjAAAXBcAfTnheloGoErcsxZ520oh5Cgyb+QXellrCTm8IoTrBXRGc8 supLf9rdLbvA2PhjJYRfIUvyxuI7 X-Google-Smtp-Source: APXvYqxePoWvjclwPN6Hn0HEwXtpncVCcAWbLLdwfpnWky34Rkr1EzxEpFIMIBKf2LgsUKnWFBPpbg== X-Received: by 2002:a17:90a:9dca:: with SMTP id x10mr15812605pjv.139.1573779661480; Thu, 14 Nov 2019 17:01:01 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id g3sm7521995pfo.82.2019.11.14.17.01.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:01 -0800 (PST) Date: Thu, 14 Nov 2019 17:00:59 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 12/27] t5317: use ! grep to check for no matching lines Message-ID: <52836aa59a84bf61781cd3501679011a36ac41e7.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 Several times in t5317, we would use `wc -l` to ensure that a grep result is empty. However, grep already has a way to do that... Its return code! Use ! grep in the cases where we are ensuring that there are no matching lines. Signed-off-by: Denton Liu --- t/t5317-pack-objects-filter-objects.sh | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/t/t5317-pack-objects-filter-objects.sh b/t/t5317-pack-objects-filter-objects.sh index a8bbad74e2..dc0446574b 100755 --- a/t/t5317-pack-objects-filter-objects.sh +++ b/t/t5317-pack-objects-filter-objects.sh @@ -45,12 +45,7 @@ test_expect_success 'verify blob:none packfile has no blobs' ' git -C r1 index-pack ../filter.pack && git -C r1 verify-pack -v ../filter.pack >verify_result && - grep blob verify_result | - awk -f print_1.awk | - sort >observed && - - nr=$(wc -l verify_result && - grep blob verify_result | - awk -f print_1.awk | - sort >observed && - - nr=$(wc -l verify_result && - grep blob verify_result | - awk -f print_1.awk | - sort >observed && - - nr=$(wc -l X-Patchwork-Id: 11244633 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 B22F417E6 for ; Fri, 15 Nov 2019 01:01:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9250620727 for ; Fri, 15 Nov 2019 01:01:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MrJaQJIv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727376AbfKOBBF (ORCPT ); Thu, 14 Nov 2019 20:01:05 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:33868 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKOBBE (ORCPT ); Thu, 14 Nov 2019 20:01:04 -0500 Received: by mail-pf1-f193.google.com with SMTP id n13so5485754pff.1 for ; Thu, 14 Nov 2019 17:01:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sAOVtsmEgzRWCTJ/CHwqxE5je/Gt8viLuSR0eJaLVq0=; b=MrJaQJIvuKuebaRTfTvXPcbeE3kSxvg1tBrIg1oIKrmWFO6eDd4Vi0DHKw5g99+wm7 jypRs3JGaqFvnkarZ/K4heiBmpykGfknMW3cSrcVAXMJKNCy+YQYDgnFkTNOniWheYdQ kS2ffvHv1kyONJuT4yHo1BNJUkPL17mhfpBbRdJL7fV48C92irl+hMyQviEvzOyAPDK6 R9RSb/kYE6VOYAMMpJe0Fh4Fkmz1IOHbjKy142iZvRypSC48qnYElKrDbX4L478Wg1r9 3Qqo4UEobuvrdKhY1drwpluK35PdHjZGuYd5VTof2lmIHjNCRr9jdZQ9MjAX4YSW8S3U bMoA== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sAOVtsmEgzRWCTJ/CHwqxE5je/Gt8viLuSR0eJaLVq0=; b=N0fDca88/N9a0VQMaTv9pGI0i7cfv1JH8EDpnS4VozGuHzm8XJVXuk72wjJkFTAuLi T6kd4XRprhveh14aMUwEvo1rwv7ujMnN3moUdhaMBfw3UZSMGuqXZ0xj2f70h+NckQge tDsENrhZ+jczJQlO5VzypUqbVqKbmrLCDBtW0SrbeY0LwZguhXaxkra6MD57fzSIfvDW qE4cdnkJiifT9jERpAdev/c2Pb+uWrxlyGOj8iYwbZRjY61dumQiA3o9pT6KgPZlQ6QV 9wlvsQOY7OS6JnPx5f/GsQ5LoEQ6bvIireCljy1Cn2h3HwOxcBsk++qXWxrtyT3zq8ST 19Vg== X-Gm-Message-State: APjAAAUHoatVACC9w+4DTwC/cl44cVkw4WtZ02zH9lnDEYewnodMrmT4 W3d9oKrxzKXC7O/6k4ERmwx0OzE9 X-Google-Smtp-Source: APXvYqzSnKekSqy3GfFJqfGvG2WPTQ9OpPU5mpYWPIwe5X8QiEB043wx4hBiJEoIIckjO0ydV2UZbg== X-Received: by 2002:a17:90a:cc18:: with SMTP id b24mr15399377pju.141.1573779663560; Thu, 14 Nov 2019 17:01:03 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id k24sm9351966pfk.63.2019.11.14.17.01.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:03 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:01 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 13/27] t5703: stop losing return codes of git commands Message-ID: <8fc59e67d74faabf43965a5eac1a4147124c56d5.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 Currently, there are two ways where the return codes of git commands are lost. The first way is when a command is in the upstream of a pipe. 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. The other way is when a command is in a non-assignment command substitution. The return code will be lost in favour of the surrounding command's. Rewrite instances of this such that git commands are in an assignment-only command substitution. Signed-off-by: Denton Liu --- t/t5703-upload-pack-ref-in-want.sh | 52 +++++++++++++++++++----------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh index 3a2c143c6d..9f6d837720 100755 --- a/t/t5703-upload-pack-ref-in-want.sh +++ b/t/t5703-upload-pack-ref-in-want.sh @@ -18,14 +18,16 @@ get_actual_commits () { p }' o.pack && git index-pack o.pack && - git verify-pack -v o.idx | grep commit | cut -c-40 | sort >actual_commits + git verify-pack -v o.idx >objs && + grep commit objs | cut -c-40 | sort >actual_commits } check_output () { get_actual_refs && test_cmp expected_refs actual_refs && get_actual_commits && - test_cmp expected_commits actual_commits + sort expected_commits >sorted_commits && + test_cmp sorted_commits actual_commits } # c(o/foo) d(o/bar) @@ -75,17 +77,19 @@ test_expect_success 'invalid want-ref line' ' ' test_expect_success 'basic want-ref' ' + oid=$(git rev-parse f) && cat >expected_refs <<-EOF && - $(git rev-parse f) refs/heads/master + $oid refs/heads/master EOF - git rev-parse f | sort >expected_commits && + git rev-parse f >expected_commits && + oid=$(git rev-parse a) && test-tool pkt-line pack >in <<-EOF && command=fetch 0001 no-progress want-ref refs/heads/master - have $(git rev-parse a) + have $oid done 0000 EOF @@ -95,19 +99,22 @@ test_expect_success 'basic want-ref' ' ' test_expect_success 'multiple want-ref lines' ' + oid_c=$(git rev-parse c) && + oid_d=$(git rev-parse d) && cat >expected_refs <<-EOF && - $(git rev-parse c) refs/heads/o/foo - $(git rev-parse d) refs/heads/o/bar + $oid_c refs/heads/o/foo + $oid_d refs/heads/o/bar EOF - git rev-parse c d | sort >expected_commits && + git rev-parse c d >expected_commits && + oid=$(git rev-parse b) && test-tool pkt-line pack >in <<-EOF && command=fetch 0001 no-progress want-ref refs/heads/o/foo want-ref refs/heads/o/bar - have $(git rev-parse b) + have $oid done 0000 EOF @@ -117,10 +124,11 @@ test_expect_success 'multiple want-ref lines' ' ' test_expect_success 'mix want and want-ref' ' + oid=$(git rev-parse f) && cat >expected_refs <<-EOF && - $(git rev-parse f) refs/heads/master + $oid refs/heads/master EOF - git rev-parse e f | sort >expected_commits && + git rev-parse e f >expected_commits && test-tool pkt-line pack >in <<-EOF && command=fetch @@ -138,17 +146,19 @@ test_expect_success 'mix want and want-ref' ' ' test_expect_success 'want-ref with ref we already have commit for' ' + oid=$(git rev-parse c) && cat >expected_refs <<-EOF && - $(git rev-parse c) refs/heads/o/foo + $oid refs/heads/o/foo EOF >expected_commits && + oid=$(git rev-parse c) && test-tool pkt-line pack >in <<-EOF && command=fetch 0001 no-progress want-ref refs/heads/o/foo - have $(git rev-parse c) + have $oid done 0000 EOF @@ -211,13 +221,14 @@ test_expect_success 'fetching with exact OID' ' rm -rf local && cp -r "$LOCAL_PRISTINE" local && + oid=$(git -C "$REPO" rev-parse d) && GIT_TRACE_PACKET="$(pwd)/log" git -C local fetch origin \ - $(git -C "$REPO" rev-parse d):refs/heads/actual && + "$oid":refs/heads/actual && git -C "$REPO" rev-parse "d" >expected && git -C local rev-parse refs/heads/actual >actual && test_cmp expected actual && - grep "want $(git -C "$REPO" rev-parse d)" log + grep "want $oid" log ' test_expect_success 'fetching multiple refs' ' @@ -239,13 +250,14 @@ test_expect_success 'fetching ref and exact OID' ' rm -rf local && cp -r "$LOCAL_PRISTINE" local && + oid=$(git -C "$REPO" rev-parse b) && GIT_TRACE_PACKET="$(pwd)/log" git -C local fetch origin \ - master $(git -C "$REPO" rev-parse b):refs/heads/actual && + master "$oid":refs/heads/actual && git -C "$REPO" rev-parse "master" "b" >expected && git -C local rev-parse refs/remotes/origin/master refs/heads/actual >actual && test_cmp expected actual && - grep "want $(git -C "$REPO" rev-parse b)" log && + grep "want $oid" log && grep "want-ref refs/heads/master" log ' @@ -312,9 +324,11 @@ inconsistency () { # repository appears to change during negotiation, for example, when # different servers in a load-balancing arrangement serve (stateless) # RPCs during a single negotiation. + oid1=$(git -C "$REPO" rev-parse $1) && + oid2=$(git -C "$REPO" rev-parse $2) && printf "s/%s/%s/" \ - $(git -C "$REPO" rev-parse $1 | tr -d "\n") \ - $(git -C "$REPO" rev-parse $2 | tr -d "\n") \ + $(echo "$oid1" | tr -d "\n") \ + $(echo "$oid2" | tr -d "\n") \ >"$HTTPD_ROOT_PATH/one-time-sed" } From patchwork Fri Nov 15 01:01:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244635 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 C7F6E138C for ; Fri, 15 Nov 2019 01:01:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A90FD20727 for ; Fri, 15 Nov 2019 01:01:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="drFlDWdi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727384AbfKOBBH (ORCPT ); Thu, 14 Nov 2019 20:01:07 -0500 Received: from mail-pf1-f175.google.com ([209.85.210.175]:33694 "EHLO mail-pf1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKOBBG (ORCPT ); Thu, 14 Nov 2019 20:01:06 -0500 Received: by mail-pf1-f175.google.com with SMTP id c184so5484199pfb.0 for ; Thu, 14 Nov 2019 17:01:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=w5qreCzgo1Ie357SUBp7hNDQYI1WGp18wzwHQE3yqmI=; b=drFlDWdiXyBH7H0148xDY61cbZkTHJ4ULAIgDbeq9kUvi7p7MIMWyuWTR++AB17/6y /BvZLg6VdRy30uz/bKjfL3kW6Hu6Jx80VeuzQCt7qeiwfoWQG9QM9v9ItcOTHQpoU2Ff BD2vN+eEbU44EVuzE1vlwa9/tj+83ogufbNHYOaABnL2V/OAmt8mZ+/RQ65Z6uypA7En u1dorB5EGviGp/lFXHAfsVbdTOjp94yBpJzOvL36DMwtYngnlzUQ+1w96RF6ACKp+Aa7 UlYz9bVAclqJgaEGfJ3YjnXdoeFDiiTmgm6a+OghFXiyghHNWyeATEmYELZP79eu05do LI2g== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=w5qreCzgo1Ie357SUBp7hNDQYI1WGp18wzwHQE3yqmI=; b=E1H0I72SGA3sKvH+hZ+NRtM0pBjfazJGNz0nzzctjjOa/k2SfJLo34OBnVBq4h+ycW FgxbhiHxmB+o0RZXMrzrPG5ogItFD4bsE468iVDnKYd7uQbgUErZXgwKnoR6x7ujhOj2 /ZvVbJcUAVxKflb7odejv8qTVdKI7YVzUHPslilbcdRuSMbk41car2uCGks4rd6uq0TI jD8QqJ3EOZyUchzM44xsx/WQ5i0AwmR05Su5h/XMqxN0ghwMlfZ0VVCZEExWxNBz64V7 IobnK0zl2w5ZdyGoUw4oOXB1crajfhY0pREUjc2gKAw3lhaWjbB0JK8DDNqSuhs4+xdb juLg== X-Gm-Message-State: APjAAAU1GfSe94m3vrOxha71Ru5PZ7aQU13pTsz3trfOqt/5RK96F6id O0bm4Pu4MEcAOwRoqheaqScRtht3 X-Google-Smtp-Source: APXvYqx41UgEkx2L2MxyHKDsnWYFf5qhCvkGAMiN1ZDOYLqzzGVkJCag9mK623RvNCZV2zXELy7UXw== X-Received: by 2002:a63:f743:: with SMTP id f3mr10288408pgk.410.1573779665727; Thu, 14 Nov 2019 17:01:05 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id 125sm7955394pfu.136.2019.11.14.17.01.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:05 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:03 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 14/27] t7501: remove spaces after redirect operators Message-ID: <3cb65b5954f5c0297e465f6d5261437debdfdfe6.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 For shell scripts, the usual convention is for there to be no space after redirection operators, (e.g. `>file`, not `> file`). Remove these spaces wherever they appear. Signed-off-by: Denton Liu --- t/t7501-commit-basic-functionality.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/t/t7501-commit-basic-functionality.sh b/t/t7501-commit-basic-functionality.sh index f1349af56e..5765d33c53 100755 --- a/t/t7501-commit-basic-functionality.sh +++ b/t/t7501-commit-basic-functionality.sh @@ -150,7 +150,7 @@ test_expect_success 'setup: commit message from file' ' test_expect_success 'amend commit' ' cat >editor <<-\EOF && #!/bin/sh - sed -e "s/a file/an amend commit/g" < "$1" > "$1-" + sed -e "s/a file/an amend commit/g" <"$1" >"$1-" mv "$1-" "$1" EOF chmod 755 editor && @@ -263,7 +263,7 @@ test_expect_success 'using message from other commit' ' test_expect_success 'editing message from other commit' ' cat >editor <<-\EOF && #!/bin/sh - sed -e "s/amend/older/g" < "$1" > "$1-" + sed -e "s/amend/older/g" <"$1" >"$1-" mv "$1-" "$1" EOF chmod 755 editor && @@ -367,7 +367,7 @@ test_expect_success 'amend commit to fix author' ' -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ expected && git commit --amend --author="$author" && - git cat-file -p HEAD > current && + git cat-file -p HEAD >current && test_cmp expected current ' @@ -382,7 +382,7 @@ test_expect_success 'amend commit to fix date' ' -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ expected && git commit --amend --date="$newtick" && - git cat-file -p HEAD > current && + git cat-file -p HEAD >current && test_cmp expected current ' @@ -448,7 +448,7 @@ test_expect_success 'signoff gap' ' git commit -s -m "welcome $alt" && - git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && ( echo welcome && echo && @@ -468,7 +468,7 @@ test_expect_success 'signoff gap 2' ' We have now $alt" && - git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && ( echo welcome && echo && @@ -489,7 +489,7 @@ test_expect_success 'signoff respects trailer config' ' non-trailer line Myfooter: x" && - git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && ( echo subject && echo && @@ -506,7 +506,7 @@ Myfooter: x" && non-trailer line Myfooter: x" && - git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && ( echo subject && echo && @@ -560,14 +560,14 @@ test_expect_success 'amend commit to fix author' ' -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ expected && git commit --amend --author="$author" && - git cat-file -p HEAD > current && + git cat-file -p HEAD >current && test_cmp expected current ' test_expect_success 'git commit with dirty index' ' - echo tacocat > elif && - echo tehlulz > chz && + echo tacocat >elif && + echo tehlulz >chz && git add chz && git commit elif -m "tacocat is a palindrome" && git show --stat | grep elif && From patchwork Fri Nov 15 01:01:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244637 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 00218930 for ; Fri, 15 Nov 2019 01:01:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC97920727 for ; Fri, 15 Nov 2019 01:01:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Hrqnq/9f" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727387AbfKOBBK (ORCPT ); Thu, 14 Nov 2019 20:01:10 -0500 Received: from mail-pf1-f180.google.com ([209.85.210.180]:41130 "EHLO mail-pf1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKOBBJ (ORCPT ); Thu, 14 Nov 2019 20:01:09 -0500 Received: by mail-pf1-f180.google.com with SMTP id p26so5466909pfq.8 for ; Thu, 14 Nov 2019 17:01:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uzrsn/+Efj+Ey+0jxyEWfRPrbH76H+d62MPSEsSJucs=; b=Hrqnq/9fAJ8NdYmewYaW6DB+9aPL6bwYj7C60gYUMygeLv5t0OQ5KLW7oVFHNC5eC5 Fo+Dv6rOpeH6rdqLaeUgCQHiwND+0Zbr+xpcelJanWt9pgqywJCtYp9ma3572a0W7YoS +6szSPINY1AtEG8Kx3OmCRTZKan9rFOka4juvlk5+ok13t7ooFKXI9p3NgCtnjQ9elx7 X2ynUanScpK1ppTAYlwCY2SwMq0KiTH4umDe2WHxizQYfVxM8f3HbAnQdBYrJrqgX0cR saZLbl5O9iBCZaYwcuINROWwMOBOslT6Y9dLcFhBWaljbnuy+9dLrRr8ewhADn025AQ4 /zTw== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uzrsn/+Efj+Ey+0jxyEWfRPrbH76H+d62MPSEsSJucs=; b=boMuqwC9HeIHLYyGnvHTZNE2Lusbv8uyA1nAu5/DiIUEsXNHsprOOHx4aeQT5J01Os n8sixyXbwP9qz72jcZUn9eLx9RYWsInWcDViTtrPX2hyJtzgqwbn9b2NzP8XL9OcDiM6 jpwAqTWpO4Mp6F4R065knhIaMybrD43KcfxE8UsMi6jfv8IN1UKsDwY2OWTRMdYtGLb4 cMIcQQEupXjejQz4nvYpFuwZu7YMgnKPdPLQQh4CRA+jCCQaXcNSp/EREDVT8cSt0dDT E7I1TKr8grplB/UQcbtQOUb02RpxecL1xUbwczzVoH8UnF8uWC/W2ZV/teF2TRqHFFYl S80w== X-Gm-Message-State: APjAAAW42QJu7m5MTPWqs4dlYnZTnfmgowAPmZmZGbHrk8su8tFyBN/k d1r93vTQe6ijQ4/6t0IKZax81wm3 X-Google-Smtp-Source: APXvYqz5Vg5tHpxJdz4YxClksxrAFQXpB2bzue6FN55a4t0WSMz32sGpzHqH08V5fRGIuJFZ3iGcYA== X-Received: by 2002:a65:609a:: with SMTP id t26mr13658882pgu.349.1573779668235; Thu, 14 Nov 2019 17:01:08 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id q18sm7406222pgv.84.2019.11.14.17.01.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:07 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:06 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 15/27] t7501: stop losing return codes of git commands Message-ID: References: MIME-Version: 1.0 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/t7501-commit-basic-functionality.sh | 69 +++++++++++++++------------ 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/t/t7501-commit-basic-functionality.sh b/t/t7501-commit-basic-functionality.sh index 5765d33c53..110b4bf459 100755 --- a/t/t7501-commit-basic-functionality.sh +++ b/t/t7501-commit-basic-functionality.sh @@ -285,9 +285,8 @@ test_expect_success 'overriding author from command line' ' ' test_expect_success PERL 'interactive add' ' - echo 7 | - git commit --interactive | - grep "What now" + echo 7 | test_must_fail git commit --interactive >out && + grep "What now" out ' test_expect_success PERL "commit --interactive doesn't change index if editor aborts" ' @@ -362,10 +361,10 @@ test_expect_success 'amend commit to fix author' ' oldtick=$GIT_AUTHOR_DATE && test_tick && git reset --hard && - git cat-file -p HEAD | + git cat-file -p HEAD >commit && sed -e "s/author.*/author $author $oldtick/" \ - -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ - expected && + -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" \ + commit >expected && git commit --amend --author="$author" && git cat-file -p HEAD >current && test_cmp expected current @@ -377,10 +376,10 @@ test_expect_success 'amend commit to fix date' ' test_tick && newtick=$GIT_AUTHOR_DATE && git reset --hard && - git cat-file -p HEAD | + git cat-file -p HEAD >commit && sed -e "s/author.*/author $author $newtick/" \ - -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ - expected && + -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" \ + commit >expected && git commit --amend --date="$newtick" && git cat-file -p HEAD >current && test_cmp expected current @@ -409,12 +408,13 @@ test_expect_success 'sign off (1)' ' echo 1 >positive && git add positive && git commit -s -m "thank you" && - git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + git cat-file commit HEAD >commit && + sed -e "1,/^\$/d" commit >actual && ( echo thank you && echo && - git var GIT_COMMITTER_IDENT | - sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" + git var GIT_COMMITTER_IDENT >ident && + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ident ) >expected && test_cmp expected actual @@ -428,13 +428,14 @@ test_expect_success 'sign off (2)' ' git commit -s -m "thank you $existing" && - git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + git cat-file commit HEAD >commit && + sed -e "1,/^\$/d" commit >actual && ( echo thank you && echo && echo $existing && - git var GIT_COMMITTER_IDENT | - sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" + git var GIT_COMMITTER_IDENT >ident && + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ident ) >expected && test_cmp expected actual @@ -448,13 +449,14 @@ test_expect_success 'signoff gap' ' git commit -s -m "welcome $alt" && - git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + git cat-file commit HEAD >commit && + sed -e "1,/^\$/d" commit >actual && ( echo welcome && echo && echo $alt && - git var GIT_COMMITTER_IDENT | - sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" + git var GIT_COMMITTER_IDENT >ident && + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ident ) >expected && test_cmp expected actual ' @@ -468,15 +470,16 @@ test_expect_success 'signoff gap 2' ' We have now $alt" && - git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + git cat-file commit HEAD >commit && + sed -e "1,/^\$/d" commit >actual && ( echo welcome && echo && echo We have now && echo $alt && echo && - git var GIT_COMMITTER_IDENT | - sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" + git var GIT_COMMITTER_IDENT >ident && + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" ident ) >expected && test_cmp expected actual ' @@ -489,7 +492,8 @@ test_expect_success 'signoff respects trailer config' ' non-trailer line Myfooter: x" && - git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + git cat-file commit HEAD >commit && + sed -e "1,/^\$/d" commit >actual && ( echo subject && echo && @@ -506,7 +510,8 @@ Myfooter: x" && non-trailer line Myfooter: x" && - git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + git cat-file commit HEAD >commit && + sed -e "1,/^\$/d" commit >actual && ( echo subject && echo && @@ -538,7 +543,8 @@ test_expect_success 'multiple -m' ' >negative && git add negative && git commit -m "one" -m "two" -m "three" && - git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + git cat-file commit HEAD >commit && + sed -e "1,/^\$/d" commit >actual && ( echo one && echo && @@ -555,10 +561,10 @@ test_expect_success 'amend commit to fix author' ' oldtick=$GIT_AUTHOR_DATE && test_tick && git reset --hard && - git cat-file -p HEAD | + git cat-file -p HEAD >commit && sed -e "s/author.*/author $author $oldtick/" \ - -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ - expected && + -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" \ + commit >expected && git commit --amend --author="$author" && git cat-file -p HEAD >current && test_cmp expected current @@ -570,8 +576,10 @@ test_expect_success 'git commit with dirty index' ' echo tehlulz >chz && git add chz && git commit elif -m "tacocat is a palindrome" && - git show --stat | grep elif && - git diff --cached | grep chz + git show --stat >stat && + grep elif stat && + git diff --cached >diff && + grep chz diff ' test_expect_success 'same tree (single parent)' ' @@ -584,7 +592,8 @@ test_expect_success 'same tree (single parent)' ' test_expect_success 'same tree (single parent) --allow-empty' ' git commit --allow-empty -m "forced empty" && - git cat-file commit HEAD | grep forced + git cat-file commit HEAD >commit && + grep forced commit ' From patchwork Fri Nov 15 01:01:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244639 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 D3E40138C for ; Fri, 15 Nov 2019 01:01:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4D312072C for ; Fri, 15 Nov 2019 01:01:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="soG/vpnD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727394AbfKOBBM (ORCPT ); Thu, 14 Nov 2019 20:01:12 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43874 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKOBBM (ORCPT ); Thu, 14 Nov 2019 20:01:12 -0500 Received: by mail-pg1-f193.google.com with SMTP id l24so4870757pgh.10 for ; Thu, 14 Nov 2019 17:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ec0JRC1t+f1XBdO8obEydFFVrQbRdt5jlQ69Rgyj01c=; b=soG/vpnDP3g9IDGIWNQKoe7P+aJnRWEOGms+CwY3ViOZ184nOhaETsLEFcCMwC501K vv49ncwKgrbMrnWrollCMXKg6+tLSqEj4/u0FYc9L5T7zxoNSDkH2z3hoertnIrWO2Si sHXPOKr8iN3P0i32rtENxM5IW5pqNRgxc72rRAxC+f2qOqady2MeUr/BqV3sJOo1NdLC v57TMwhWU688o7bVMjWw7vWDUNLZSFZOjHmCqcm4GJMvN1YRU8kEnGJnlOyjBD657npk LWrZzylOxcC0MSQ4jEC4j3mybz5/ZNyghqfOYAbJV12V4DJ1+CPXEDpCH4GddqhqFWQk k/4w== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ec0JRC1t+f1XBdO8obEydFFVrQbRdt5jlQ69Rgyj01c=; b=FJfqnKqfi3u5uIrv3cP8r85JOMGJfCw+FK2Unll2sq9JxQD2+do2t2O04oRkINSHoO zU5+OyFZniCgXYbYnhLif9UQisKbd5J6os3797iB2yr6xNQfUA5WBBtAxiX/v4blFO84 NyAf1n2k4JrKicDh3OzjhK3HLSgKO8lnyBi3pZAZADUu2ZQeNaRW27/DZmw5eXKPexK8 pyPuoOX3BQfjr94/aFO3f/YW3Y/zd3+SO9wmiStaQ/wER6oaGcRaNWfLLSNzSIsqVrIN 188bDRev5pDrsyZUvoyrIgREHlY8h51dWepVtCB0C+6mpOEcrxP+MudlD1JJmvFSLBaE V1YQ== X-Gm-Message-State: APjAAAVqC+hHqlrLkidJ1uJ53kxszNWYpkGq8ud/2M/YuCXyaToOZQmS QEdxZY7ZvIwbE8uGGhRvbx4WY4kX X-Google-Smtp-Source: APXvYqwU+hwHmEoO3ZN5ALce1FA0t8nvNXN61SRX/8R0LJptGZ8hz1/ZYBuMslNgzTuld1SrsdM/hQ== X-Received: by 2002:a63:c103:: with SMTP id w3mr6557221pgf.275.1573779670529; Thu, 14 Nov 2019 17:01:10 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id j20sm7479763pff.182.2019.11.14.17.01.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:09 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:08 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 16/27] t7700: drop redirections to /dev/null Message-ID: References: MIME-Version: 1.0 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 Since output is silenced when running without `-v` and debugging output is useful with `-v`, remove redirections to /dev/null as it is not useful. In one case where the output of stdout is consumed, redirect the output of test_commit to stderr. Signed-off-by: Denton Liu --- t/t7700-repack.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index 4e855bc21b..e1a689d6a9 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -5,7 +5,7 @@ test_description='git repack works correctly' . ./test-lib.sh commit_and_pack() { - test_commit "$@" >/dev/null && + test_commit "$@" 1>&2 && SHA1=$(git pack-objects --all --unpacked --incremental .git/objects/pack/pack /dev/null && + git pack-objects pack && # The second pack will contain the excluded object packsha1=$(git rev-list --objects --all | grep file2 | git pack-objects pack) && @@ -235,7 +235,7 @@ test_expect_success 'incremental repack does not complain' ' test_expect_success 'bitmaps can be disabled on bare repos' ' git -c repack.writeBitmaps=false -C bare.git repack -ad && - bitmap=$(ls bare.git/objects/pack/*.bitmap 2>/dev/null || :) && + bitmap=$(ls bare.git/objects/pack/*.bitmap || :) && test -z "$bitmap" ' From patchwork Fri Nov 15 01:01:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244641 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 1CBEA138C for ; Fri, 15 Nov 2019 01:01:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F19CC20725 for ; Fri, 15 Nov 2019 01:01:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HZqLTh3p" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727402AbfKOBBO (ORCPT ); Thu, 14 Nov 2019 20:01:14 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38766 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKOBBO (ORCPT ); Thu, 14 Nov 2019 20:01:14 -0500 Received: by mail-pg1-f196.google.com with SMTP id 15so4893797pgh.5 for ; Thu, 14 Nov 2019 17:01:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gyf0mQdI+ahL2QZYsGrQPm9DBYKLwCIHsQU+kEth2aw=; b=HZqLTh3pjl/psxCkHR5/9reCFOPA9vFYQ4Al8AZoW5tajz5n7YnGIjlviGmImDGMCf lqN9qxhIEOt/8EvNaA4hBmHqwxWL7YdzH3e/fKJW+/SZENzlMlHIX5W4yfd8mmUolm17 h/ARvCqPONWjaAmFVjFZQoJv51DEGpORHCz8QPkJliderOmkIJa0kcm+4pBLWaRWBwP3 /8vX5ZsUooWs0nNrnlN9gKbV8ek24gdPMBM4ngjSjAPG3xnaH4sWgQuybgJ3jfwR81WM +IfL7uYMZ9pqOW858ZFhPCZPyTRtlqODU48L9+BvfkPBttn4PY1FLhKFAbgKoo5sDpP+ jklw== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gyf0mQdI+ahL2QZYsGrQPm9DBYKLwCIHsQU+kEth2aw=; b=HMn4mZ+xAfZ2EuQzmcdq1TlbO8OXIgPRu0l7bSU2Fo6IN76rzBvRKi1P6lbSrVAkuc uaHG/g3+BEnb7m46pOQ/ZVqd55NdA9RbSILj9JaK0dl5B7b2y24ZNuLdbqH7PmxVCswO 13iwzVcbEvNRhz88j5au7lR2ve4gASJwQbP4C8xD7BF5Pj9hSfILqOMvf1BPfHcN84fY sXy8vNCxmAJzlRy4NBuZZHI+qX1LL3WUuYjZLmjctz4jXHlMLjDuvYGDvOzlQozaEL0u foM+E+4/+yHJQydPpkgE/KVrYv1CHgUuex68mbahfpG43m/dtwBlfG0ziUp+5J6GsUrD kpzQ== X-Gm-Message-State: APjAAAVdQe5Yd6rDRDj59XRaJ3OBIzRbpSGSbWutGQFPx7bC3oraR7vz 0rXvTJAKpfeUlU3DUzygERDcI60f X-Google-Smtp-Source: APXvYqyEYtAzDVdujYKGP3VJfHF8jTI31jsthEa9LhAeCxjEgfT3E68ZRAGIbZkxXXG6QY3L/Qa8nA== X-Received: by 2002:a62:f243:: with SMTP id y3mr14438136pfl.196.1573779672855; Thu, 14 Nov 2019 17:01:12 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id x13sm8142620pfc.46.2019.11.14.17.01.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:12 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:10 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 17/27] t7700: remove spaces after redirect operators Message-ID: <206ac68a91f4fabe184403e41496bc341f3f18d1.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 For shell scripts, the usual convention is for there to be no space after redirection operators, (e.g. `>file`, not `> file`). Remove these spaces wherever they appear. Signed-off-by: Denton Liu --- t/t7700-repack.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index e1a689d6a9..8936928387 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -11,8 +11,8 @@ commit_and_pack() { } test_expect_success 'objects in packs marked .keep are not repacked' ' - echo content1 > file1 && - echo content2 > file2 && + echo content1 >file1 && + echo content2 >file2 && git add . && test_tick && git commit -m initial_commit && @@ -75,8 +75,8 @@ test_expect_success 'writing bitmaps via config can duplicate .keep objects' ' test_expect_success 'loose objects in alternate ODB are not repacked' ' mkdir alt_objects && - echo $(pwd)/alt_objects > .git/objects/info/alternates && - echo content3 > file3 && + echo $(pwd)/alt_objects >.git/objects/info/alternates && + echo content3 >file3 && objsha1=$(GIT_OBJECT_DIRECTORY=alt_objects git hash-object -w file3) && git add file3 && test_tick && @@ -111,7 +111,7 @@ test_expect_success 'packed obs in alt ODB are repacked even when local repo is test_expect_success 'packed obs in alt ODB are repacked when local repo has packs' ' rm -f .git/objects/pack/* && - echo new_content >> file1 && + echo new_content >>file1 && git add file1 && test_tick && git commit -m more_content && @@ -169,12 +169,12 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' ' mv pack-* .git/objects/pack/ && test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx | egrep "^$csha1 " | sort | uniq | wc -l) && - echo > .git/objects/info/alternates && + echo >.git/objects/info/alternates && test_must_fail git show $csha1 ' test_expect_success 'local packed unreachable obs that exist in alternate ODB are not loosened' ' - echo $(pwd)/alt_objects > .git/objects/info/alternates && + echo $(pwd)/alt_objects >.git/objects/info/alternates && echo "$csha1" | git pack-objects --non-empty --all --reflog pack && rm -f .git/objects/pack/* && mv pack-* .git/objects/pack/ && @@ -186,7 +186,7 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar mv pack-* .git/objects/pack/ && test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx | egrep "^$csha1 " | sort | uniq | wc -l) && - echo > .git/objects/info/alternates && + echo >.git/objects/info/alternates && test_must_fail git show $csha1 ' @@ -196,7 +196,7 @@ test_expect_success 'objects made unreachable by grafts only are kept' ' H0=$(git rev-parse HEAD) && H1=$(git rev-parse HEAD^) && H2=$(git rev-parse HEAD^^) && - echo "$H0 $H2" > .git/info/grafts && + echo "$H0 $H2" >.git/info/grafts && git reflog expire --expire=$test_tick --expire-unreachable=$test_tick --all && git repack -a -d && git cat-file -t $H1 From patchwork Fri Nov 15 01:01:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244645 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 3D27B17E6 for ; Fri, 15 Nov 2019 01:01:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D74D20727 for ; Fri, 15 Nov 2019 01:01:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KvrCpTfd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727409AbfKOBBS (ORCPT ); Thu, 14 Nov 2019 20:01:18 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40597 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKOBBQ (ORCPT ); Thu, 14 Nov 2019 20:01:16 -0500 Received: by mail-pf1-f195.google.com with SMTP id r4so5471199pfl.7 for ; Thu, 14 Nov 2019 17:01:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Z26qB6XvVls68+5OC4K/cbfgDyvCz1xPH2n0sob8W94=; b=KvrCpTfdRTLpRVnj3Zz8B5zfOUsMor4JiJHEBYVDFyDYaCLv1UgUhzSYLMKsnJZSMi v6d/D7fiFzR45NFK9Vy8CcqQr/ygBlFOSBSBooUMvkVc0YVc/sS8bWvKMMBsKCBTKJ61 FAapszzbMHxmzt8adpwZSaBRWTwDrRRS9jKloC9p8cQHp0Nsg8yJ+H+HJRA7jcZfOe80 cbYQpWCchAt6GL6NSRWSApo7tZmY3C4MBl0ZfZs8X2tFotNfeiJYwRBcYnvkm0on5QmB NJJk4oEWX549dz3CZXHiueXG6xcDbxOYIVPCP/QN+liCdllFwNe3oNWqtOIJdInPdZ1Z n+vQ== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Z26qB6XvVls68+5OC4K/cbfgDyvCz1xPH2n0sob8W94=; b=aogUmzKOB81Y3AI3L/BJ9dGSc+1QAAOvUzHvMawrtFC4dbQEYJzeCYvPfWMM9AxrAb 3PVQ/1pcQKUf8l7ndiEJqNIxlbBFQmHyw8a7M/Mhj1K70XhtD3QXROtc6JuIR1sLDZC4 0ImVCUfPpadn9YdrQB8lxc1BES8+En/kgDTkj+zvaitmXJ4J2FNGhc4RfOO6H/GPvgHH O5RTtjleIhh+msLvZZygNFpkgQR9hs0hWA81fX1+Mke7jAFnr8AUZhW+/cPfVKIiMOn3 WzLAby4dNnmNO6n56V71qZFK8SUef+TOIMO2aahI3fWRPpV7Ji4ya52y5SwGkqTInSOX cwSQ== X-Gm-Message-State: APjAAAW4E3Sa287CY3Mqjgsjhd8ED3wapVikOKOlf7f8uNizqhZGCDze HIoRjco5GyxhZFoyf4sGKHKAy/gN X-Google-Smtp-Source: APXvYqzsaBUBu3ThzIXZgN1gjNqjImBcX9kc0ol/9GkKOFGn81yR712+BYAlfuhF25R437GfjSK2Fw== X-Received: by 2002:a17:90a:a58b:: with SMTP id b11mr16288831pjq.46.1573779674945; Thu, 14 Nov 2019 17:01:14 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id 206sm12463629pfu.45.2019.11.14.17.01.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:14 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:13 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 18/27] t7700: move keywords onto their own line Message-ID: <0d776372553d223ecf11d7dc773125bd0a549200.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 The code style for tests is to have statements on their own line if possible. Move keywords onto their own line so that they conform with the test style. Signed-off-by: Denton Liu --- t/t7700-repack.sh | 51 +++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index 8936928387..a96e876c4e 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -29,10 +29,12 @@ test_expect_success 'objects in packs marked .keep are not repacked' ' mv pack-* .git/objects/pack/ && git repack -A -d -l && git prune-packed && - for p in .git/objects/pack/*.idx; do + for p in .git/objects/pack/*.idx + do idx=$(basename $p) test "pack-$packsha1.idx" = "$idx" && continue - if git verify-pack -v $p | egrep "^$objsha1"; then + if git verify-pack -v $p | egrep "^$objsha1" + then found_duplicate_object=1 echo "DUPLICATE OBJECT FOUND" break @@ -45,10 +47,12 @@ test_expect_success 'writing bitmaps via command-line can duplicate .keep object # build on $objsha1, $packsha1, and .keep state from previous git repack -Adbl && test_when_finished "found_duplicate_object=" && - for p in .git/objects/pack/*.idx; do + for p in .git/objects/pack/*.idx + do idx=$(basename $p) test "pack-$packsha1.idx" = "$idx" && continue - if git verify-pack -v $p | egrep "^$objsha1"; then + if git verify-pack -v $p | egrep "^$objsha1" + then found_duplicate_object=1 echo "DUPLICATE OBJECT FOUND" break @@ -61,10 +65,12 @@ test_expect_success 'writing bitmaps via config can duplicate .keep objects' ' # build on $objsha1, $packsha1, and .keep state from previous git -c repack.writebitmaps=true repack -Adl && test_when_finished "found_duplicate_object=" && - for p in .git/objects/pack/*.idx; do + for p in .git/objects/pack/*.idx + do idx=$(basename $p) test "pack-$packsha1.idx" = "$idx" && continue - if git verify-pack -v $p | egrep "^$objsha1"; then + if git verify-pack -v $p | egrep "^$objsha1" + then found_duplicate_object=1 echo "DUPLICATE OBJECT FOUND" break @@ -83,8 +89,10 @@ test_expect_success 'loose objects in alternate ODB are not repacked' ' git commit -m commit_file3 && git repack -a -d -l && git prune-packed && - for p in .git/objects/pack/*.idx; do - if git verify-pack -v $p | egrep "^$objsha1"; then + for p in .git/objects/pack/*.idx + do + if git verify-pack -v $p | egrep "^$objsha1" + then found_duplicate_object=1 echo "DUPLICATE OBJECT FOUND" break @@ -99,10 +107,13 @@ test_expect_success 'packed obs in alt ODB are repacked even when local repo is git repack -a && myidx=$(ls -1 .git/objects/pack/*.idx) && test -f "$myidx" && - for p in alt_objects/pack/*.idx; do + for p in alt_objects/pack/*.idx + do git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" - done | while read sha1 rest; do - if ! ( git verify-pack -v $myidx | grep "^$sha1" ); then + done | while read sha1 rest + do + if ! ( git verify-pack -v $myidx | grep "^$sha1" ) + then echo "Missing object in local pack: $sha1" return 1 fi @@ -119,10 +130,13 @@ test_expect_success 'packed obs in alt ODB are repacked when local repo has pack git repack -a -d && myidx=$(ls -1 .git/objects/pack/*.idx) && test -f "$myidx" && - for p in alt_objects/pack/*.idx; do + for p in alt_objects/pack/*.idx + do git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" - done | while read sha1 rest; do - if ! ( git verify-pack -v $myidx | grep "^$sha1" ); then + done | while read sha1 rest + do + if ! ( git verify-pack -v $myidx | grep "^$sha1" ) + then echo "Missing object in local pack: $sha1" return 1 fi @@ -144,10 +158,13 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' ' git repack -a -d && myidx=$(ls -1 .git/objects/pack/*.idx) && test -f "$myidx" && - for p in alt_objects/pack/*.idx; do + for p in alt_objects/pack/*.idx + do git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" - done | while read sha1 rest; do - if ! ( git verify-pack -v $myidx | grep "^$sha1" ); then + done | while read sha1 rest + do + if ! ( git verify-pack -v $myidx | grep "^$sha1" ) + then echo "Missing object in local pack: $sha1" return 1 fi From patchwork Fri Nov 15 01:01:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244643 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 917C6930 for ; Fri, 15 Nov 2019 01:01:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 71EF520725 for ; Fri, 15 Nov 2019 01:01:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sS4/cldh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727412AbfKOBBS (ORCPT ); Thu, 14 Nov 2019 20:01:18 -0500 Received: from mail-pf1-f175.google.com ([209.85.210.175]:33825 "EHLO mail-pf1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbfKOBBS (ORCPT ); Thu, 14 Nov 2019 20:01:18 -0500 Received: by mail-pf1-f175.google.com with SMTP id n13so5486086pff.1 for ; Thu, 14 Nov 2019 17:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3oyntv5x/NOliUVudqOp2u30gnSHkT0Vn0+ezmI43S8=; b=sS4/cldhPd2fAW6JSfXOm2OIAUy5tj0Ofi5XDilH4q1XJ2zAhLHZy1UtF3NhYlBZb2 B0djElDhR3GIJyPSim/b4Ut++ZLakWP5UDWh/oJonmuQTfPqtYncS1oATqOJwJG03QWq hUrHP8wv5652o8R8t8MMAEX6OwC8SZ4NBwKYsPQjvcM+kWA7i2bHxyrs2IRjR5iKyRS1 MZfTYvgqjmF6t0GnVkea/fpWAote3oMdWrJA6KIfbupfF1r0Nx0Dhbi8kpX1VH5xH9WQ 6byr9I4oYiCAOURvamsOwMaDdEmDGoi5O2B1QaT2M9+cmlSDUkwpFZXEVHDvf2uzPx+v cYUA== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3oyntv5x/NOliUVudqOp2u30gnSHkT0Vn0+ezmI43S8=; b=ueO8If9bIe8s7eoFQNF1m3fIm7sOA1pJNaMn4w9w7x8pNXNU0DiWynPNyjKYoE6fpP nFRljSLdzFF7TnezVkZYY+yje2eAg2tREWq81VRNsiJxcofjQF6FaEyTto3lOze5cfVj BBCayt/wCNm9GtmzCYLXXGWtTdwrOVmzZPxSfJVlnkvwDVA39bsJiIZ/L+7GWHBYAjx9 Mj4g67zmGH5vTxJdlaAXoIDjf9zcV5YVl/PlkDUi8rcoj0FyhAvKiemKbmmZDlQI59WV vDkCyD5ApcvpEHvopZRlSGaa5NQWyG5hy2WvZI3LTnnuT4vcgiZgX/+Prpdad68hoESI +G8Q== X-Gm-Message-State: APjAAAWUHe7nywnIxQ3EO29sfH7XXQqWFMjY04WcYUKSlaGEtavU5J4Y uyk9d+8P6bXfjeyyJu6hdGdP22uy X-Google-Smtp-Source: APXvYqysx3eyKDCHuWCK90LfuaUPMvtCo28cquVEMXNuCdK2uf50z+tczk5HMmOI5as/TTunHSbgUg== X-Received: by 2002:a63:b502:: with SMTP id y2mr13139217pge.133.1573779677231; Thu, 14 Nov 2019 17:01:17 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id w5sm8760604pfd.31.2019.11.14.17.01.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:16 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:15 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 19/27] t7700: s/test -f/test_path_is_file/ Message-ID: <70cbd273aec3da27d10e0b08d63a7494321a7b9b.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 Since we have debugging-friendly alternatives to `test -f`, replace instances of `test -f` with `test_path_is_file` so that if a command ever fails, we get better debugging information. Signed-off-by: Denton Liu --- t/t7700-repack.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index a96e876c4e..1d14ddcbdb 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -106,7 +106,7 @@ test_expect_success 'packed obs in alt ODB are repacked even when local repo is mv .git/objects/pack/* alt_objects/pack && git repack -a && myidx=$(ls -1 .git/objects/pack/*.idx) && - test -f "$myidx" && + test_path_is_file "$myidx" && for p in alt_objects/pack/*.idx do git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" @@ -129,7 +129,7 @@ test_expect_success 'packed obs in alt ODB are repacked when local repo has pack git repack && git repack -a -d && myidx=$(ls -1 .git/objects/pack/*.idx) && - test -f "$myidx" && + test_path_is_file "$myidx" && for p in alt_objects/pack/*.idx do git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" @@ -148,7 +148,7 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' ' for p in alt_objects/pack/*.pack do base_name=$(basename $p .pack) && - if test -f alt_objects/pack/$base_name.keep + if test_path_is_file alt_objects/pack/$base_name.keep then rm alt_objects/pack/$base_name.keep else @@ -157,7 +157,7 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' ' done && git repack -a -d && myidx=$(ls -1 .git/objects/pack/*.idx) && - test -f "$myidx" && + test_path_is_file "$myidx" && for p in alt_objects/pack/*.idx do git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" From patchwork Fri Nov 15 01:01:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244647 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 2F9E7930 for ; Fri, 15 Nov 2019 01:01:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0751C20727 for ; Fri, 15 Nov 2019 01:01:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MYtTFlcE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727415AbfKOBBV (ORCPT ); Thu, 14 Nov 2019 20:01:21 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38458 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbfKOBBU (ORCPT ); Thu, 14 Nov 2019 20:01:20 -0500 Received: by mail-pl1-f195.google.com with SMTP id w8so3487458plq.5 for ; Thu, 14 Nov 2019 17:01:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XDaEV66oyC8M3jsTFMc8uV+NTrs+JXbrreg96Pzbs2Q=; b=MYtTFlcEk7M/YpyAV/UhT9D4K58fqBTfpKXRHwQHt2TZcLqTdg1rPtnUlOMvnnoQl9 Asa83wJMwlviGUoDcD8lg4TKpXfrBEr2reqiVF3CWuwsOrOHyFj3I0tsVaRzB8cmf2Wk hTEBy7tknJ9u+FaXyfk2K0Jk2oK+akZZ+44siR2IYa3YjPU0FS6IUTJaqCL8h5dg5c/b TW4ZiRoyrxcdZc1MWwtnbYztZ4FMGe79J9hwNDri6gsO3jU+pXUuCRiVL7n7UnfFmEKI /Dtl8hBG5Z+ZlGcZOo2erscBFiRvD/RNY6nVuthD3+YRuFBY13Hr7TMEr6EjMmq5XCjx LmyA== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XDaEV66oyC8M3jsTFMc8uV+NTrs+JXbrreg96Pzbs2Q=; b=O2/sjwd4ccFf5M9yZRJTbJpVgotCc9pW12/RXLwU5hI2YHD/tA3jHA5O8xRFZDsYAd VG+Lmop85S/E+dN6DPYpegYHnVcqw8kWaLa3TKFQnnuSrBmyH/X13Fr1yfI+jQlgWhdb +ud9LhipqHGHVwgD2tU+twbqiUK7DSnj2nbdSBYDl/pq9irNFn0kdRmwa6WSaPa58obb CvucPnkfxofl47EP0TNT7w9YCgaiCI+Ghd/L74eDa5vZ5fys+hlMDaHDyCEaUVgal7sR SRwwvnlL/X2HOamt3y0n/TTNmghIP535NlN+VRN/g2/YQ/XSpuCPe/7yX5U09z68m8jK +PVQ== X-Gm-Message-State: APjAAAXbN+tlrbgoLPSnSOhkXMuvN7glNucQMWWhAM1F9WLjeFfljoed dabPIY7CcJmrIAfaIpEWl+Bt3TXg X-Google-Smtp-Source: APXvYqzNBGItC3Fe3yLq7PTxb+naoswJQC8d3ykuhp0X9CSaA+UdBsnbZCfjgUbmDbXY2Avmih7USg== X-Received: by 2002:a17:90a:9b87:: with SMTP id g7mr16057315pjp.64.1573779679529; Thu, 14 Nov 2019 17:01:19 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id 125sm7955717pfu.136.2019.11.14.17.01.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:19 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:17 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 20/27] t7700: stop losing return codes of git commands Message-ID: References: MIME-Version: 1.0 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/t7700-repack.sh | 64 ++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index 1d14ddcbdb..ff50722e26 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -18,14 +18,13 @@ test_expect_success 'objects in packs marked .keep are not repacked' ' git commit -m initial_commit && # Create two packs # The first pack will contain all of the objects except one - git rev-list --objects --all | grep -v file2 | - git pack-objects pack && + git rev-list --objects --all >objs && + grep -v file2 objs | git pack-objects pack && # The second pack will contain the excluded object - packsha1=$(git rev-list --objects --all | grep file2 | - git pack-objects pack) && + packsha1=$(grep file2 objs | git pack-objects pack) && >pack-$packsha1.keep && - objsha1=$(git verify-pack -v pack-$packsha1.idx | head -n 1 | - sed -e "s/^\([0-9a-f]\{40\}\).*/\1/") && + git verify-pack -v pack-$packsha1.idx >packlist && + objsha1=$(head -n 1 packlist | sed -e "s/^\([0-9a-f]\{40\}\).*/\1/") && mv pack-* .git/objects/pack/ && git repack -A -d -l && git prune-packed && @@ -33,7 +32,8 @@ test_expect_success 'objects in packs marked .keep are not repacked' ' do idx=$(basename $p) test "pack-$packsha1.idx" = "$idx" && continue - if git verify-pack -v $p | egrep "^$objsha1" + git verify-pack -v $p >packlist || return $? + if egrep "^$objsha1" packlist then found_duplicate_object=1 echo "DUPLICATE OBJECT FOUND" @@ -51,7 +51,8 @@ test_expect_success 'writing bitmaps via command-line can duplicate .keep object do idx=$(basename $p) test "pack-$packsha1.idx" = "$idx" && continue - if git verify-pack -v $p | egrep "^$objsha1" + git verify-pack -v $p >packlist || return $? + if egrep "^$objsha1" packlist then found_duplicate_object=1 echo "DUPLICATE OBJECT FOUND" @@ -69,7 +70,8 @@ test_expect_success 'writing bitmaps via config can duplicate .keep objects' ' do idx=$(basename $p) test "pack-$packsha1.idx" = "$idx" && continue - if git verify-pack -v $p | egrep "^$objsha1" + git verify-pack -v $p >packlist || return $? + if egrep "^$objsha1" packlist then found_duplicate_object=1 echo "DUPLICATE OBJECT FOUND" @@ -91,7 +93,8 @@ test_expect_success 'loose objects in alternate ODB are not repacked' ' git prune-packed && for p in .git/objects/pack/*.idx do - if git verify-pack -v $p | egrep "^$objsha1" + git verify-pack -v $p >packlist || return $? + if egrep "^$objsha1" packlist then found_duplicate_object=1 echo "DUPLICATE OBJECT FOUND" @@ -109,15 +112,18 @@ test_expect_success 'packed obs in alt ODB are repacked even when local repo is test_path_is_file "$myidx" && for p in alt_objects/pack/*.idx do - git verify-pack -v $p | sed -n -e "/^[0-9a-f]\{40\}/p" - done | while read sha1 rest + git verify-pack -v $p >packlist || return $? + sed -n -e "/^[0-9a-f]\{40\}/p" + done >packs && + git verify-pack -v $myidx >mypacklist && + while read sha1 rest do - if ! ( git verify-pack -v $myidx | grep "^$sha1" ) + if ! grep "^$sha1" mypacklist then echo "Missing object in local pack: $sha1" return 1 fi - done + done packlist || return $? + sed -n -e "/^[0-9a-f]\{40\}/p" packlist + done >packs && + git verify-pack -v $myidx >mypacklist && + while read sha1 rest do - if ! ( git verify-pack -v $myidx | grep "^$sha1" ) + if ! grep "^$sha1" mypacklist then echo "Missing object in local pack: $sha1" return 1 fi - done + done packlist || return $? + sed -n -e "/^[0-9a-f]\{40\}/p" packlist + done >packs && + git verify-pack -v $myidx >mypacklist && + while read sha1 rest do - if ! ( git verify-pack -v $myidx | grep "^$sha1" ) + if ! grep "^$sha1" mypacklist then echo "Missing object in local pack: $sha1" return 1 fi - done + done packlist && + ! egrep "^$csha1 " packlist && echo >.git/objects/info/alternates && test_must_fail git show $csha1 ' @@ -201,8 +213,8 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar --unpack-unreachable packlist && + ! egrep "^$csha1 " && echo >.git/objects/info/alternates && test_must_fail git show $csha1 ' From patchwork Fri Nov 15 01:01:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244649 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 04400930 for ; Fri, 15 Nov 2019 01:01:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D944F20725 for ; Fri, 15 Nov 2019 01:01:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bEpeUWIQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727419AbfKOBBX (ORCPT ); Thu, 14 Nov 2019 20:01:23 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44519 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbfKOBBW (ORCPT ); Thu, 14 Nov 2019 20:01:22 -0500 Received: by mail-pg1-f194.google.com with SMTP id f19so4876763pgk.11 for ; Thu, 14 Nov 2019 17:01:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=csO+CsC/WW6HjQhBgusXd9iivYBxHPC1TaV716GdHAg=; b=bEpeUWIQObfgSEiAvWQblRGbrE0pfhGSObfJpLswjfzBa+pr9ooEFVh5aWrMwYe97N D1S2v3y+TyXRx4Pslunub2FpSh4ZYSUKQfTIXQhozgUhwFvL1Oz9GfoungVnfE1wluDb EAWHASSx5QuYqXW7KwJz5WIjEdSkHOgDTtvEugrx5xm48XTAJKRb63vnJWai7BpUDrdX 1Dc7ir6WIoXOIMMF1FIvjuelyd0zo2ETSpTBpjp2g92BsX6VYlUbRep/dqlytcVGBogM SAToSizDDbNu01W/UGdL4aSuIokb01ojYfQzuEN952z0fVGMSMN2VYWeoJ10edlVgA9g ZGQw== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=csO+CsC/WW6HjQhBgusXd9iivYBxHPC1TaV716GdHAg=; b=M2SUEWXuefs2NNKVkvRaJm7E5EdmZP61p+Qp1kMmkIuEKzR2+kGfepVojQ/w/2I5G/ rw6fHLRFfxfcbX6P6VrQhuOTy7UiMLG86CsTo8uCP8z12z6CJhZXFV29pLAkoFtQGomq GD3wI/0gGE0Eec1oGgH660FhwCSJZ82hSuijLniJJokdWcFU0srmcy1bfKZm55ikOn47 O9ZAWbbMuw+GTogL5ug+Az1q6dd/m5PR7Sxg7uXOsPVVd5pd5spLDva0ao5/Eu19HgAr EIuQjGgtABSYOKhIbhfF6U5QeAPO7M3QbMAudSYvPexz+3swsZPZHgVbhRuQKdidLXE1 XbxA== X-Gm-Message-State: APjAAAXbFNoUoMyTHz4RvRIOS0KQgWoPAxBgLQQRAbwsr8CLCwCIv05B xMXZr5zguc0S2h1g7b29VTksnGD7 X-Google-Smtp-Source: APXvYqyOHLXYNx2Xd4aSvFVUzIZhPMYs7RwYpbIc5AC19va5W/HLKAjLyIoiSGMtGX4wKPNBHvWvNA== X-Received: by 2002:a63:7c18:: with SMTP id x24mr1952422pgc.390.1573779681661; Thu, 14 Nov 2019 17:01:21 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id v14sm7546114pfe.94.2019.11.14.17.01.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:21 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:19 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 21/27] t: define test_grep_return_success() Message-ID: <3f79d23b40c0586d0351f4d721097be4f7ba26b8.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 future patch, we plan on running tests with `set -o pipefail`. However, since grep can return failure in the case that no lines are matched, this can trigger a failure in a pipe in the case where grep is being used as a filter. Define the test_grep_return_success() function which acts as a wrapper around grep but always returns 0 so that it can be used in the situation described above. Signed-off-by: Denton Liu --- t/test-lib-functions.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index b299ecc326..dddc4cc3b1 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -990,6 +990,11 @@ test_i18ngrep () { return 1 } +# Calls grep but returns zero even if no matching lines are found. +test_grep_return_success () { + grep "$@" || : +} + # Call any command "$@" but be more verbose about its # failure. This is handy for commands like "test" which do # not output anything when they fail. From patchwork Fri Nov 15 01:01:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244651 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 5EB76930 for ; Fri, 15 Nov 2019 01:01:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F5A120727 for ; Fri, 15 Nov 2019 01:01:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F4YJueJy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727422AbfKOBBZ (ORCPT ); Thu, 14 Nov 2019 20:01:25 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36262 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbfKOBBZ (ORCPT ); Thu, 14 Nov 2019 20:01:25 -0500 Received: by mail-pf1-f193.google.com with SMTP id b19so5484685pfd.3 for ; Thu, 14 Nov 2019 17:01:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=b0EVTjwMaQlT1E002U27ok5hZF+oTyo6yxdE5sj6S5Y=; b=F4YJueJyt/mbovoNotXbPk3kSRZcF52zD4winKmGgmav1o8t4b5M05mSrFU7lyH40O M682dU50tvSO8t9PEr0Eq5IvX4ay/Lj7CoQc4pIjJKfCRtrR/Hk1Ouv+WSYnaZ5NV3Mt tKWlPEVI+atMA/RZEJhxK1yh/5jSoh0WzmCLuNJaHW4b6jtRm1HFqOx2Ab16pSiPGSsC QtD8ElvgIVcQEFudrPT9vHKltngOu5iT1B8azeuOONMoMXkI/MB7yOqatwNR3WOPcHpp 96Q5H7hjZKy9Xb6vFrPWirtFH8VIZV/rYrapyC8LFpl7kj3GuN7L33n4+Yx/GDrYgNWk QRqg== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=b0EVTjwMaQlT1E002U27ok5hZF+oTyo6yxdE5sj6S5Y=; b=YbQtas9eI7ERcWZW40IeJ5iRVZWOvbSVa5ALrA3BxpzK+hlJwoiASNCAqYfTPZtYhw krX32L2i7JvuP6651vmqNGrlkGK4xiRbSTdzrCcL65Z9PnmID7YWmByF4LkYodXxALzE 7uHn6703GdD5E15Q/mCRMtCB8JeB1pXEhfC0K4VQWxfR7yZWvJhc4nXmQkGlxrohnuOQ XVZoQlQtOLHflh1xTY32ZxeVBAgVfLHkUpqeAYyvIYPOJqiJQ1SKrYp9Eq+saKwlnf3L JC9C1cpwoIzbuvDAOHYkFHqbVpjKnIP+zAhHKRYs/hUpaiegaC69b6gkQKCNhrJ82Est 9wGw== X-Gm-Message-State: APjAAAXJOulh5+n7T/exdogZj6+tyjj46GljBgQi1fkWAlkwQQ8sJKyU 1d6+UfBieukVji2t/cz09sB9hZYW X-Google-Smtp-Source: APXvYqyoJhzTcMhOmygb+3mk1y224Ja0lgaZ8ytnoVozf7egJ1IZg7v5hlK219o94QBzWYXtdnTcgg== X-Received: by 2002:a62:180a:: with SMTP id 10mr14526929pfy.40.1573779683938; Thu, 14 Nov 2019 17:01:23 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id s18sm8405178pfm.27.2019.11.14.17.01.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:23 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:22 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 22/27] t0090: mask failing grep status Message-ID: <0f3d1c04a1283675db0c6704bbdd2566d405163e.1573779465.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 future patch, we plan on running tests with `set -o pipefail`. However, since grep can return failure in the case that no lines are matched, this can trigger a failure in a pipe in the case where grep is being used as a filter. Use test_grep_return_success() instead of grep so that we don't fail even if we have no matching lines. Signed-off-by: Denton Liu --- t/t0090-cache-tree.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh index 5a633690bf..b0f3b69d1d 100755 --- a/t/t0090-cache-tree.sh +++ b/t/t0090-cache-tree.sh @@ -22,7 +22,7 @@ generate_expected_cache_tree_rec () { # ls-files might have foo/bar, foo/bar/baz, and foo/bar/quux # We want to count only foo because it's the only direct child git ls-files >files && - subtrees=$(grep / files|cut -d / -f 1|uniq) && + subtrees=$(test_grep_return_success / files|cut -d / -f 1|uniq) && subtree_count=$(echo "$subtrees"|awk -v c=0 '$1 != "" {++c} END {print c}') && entries=$(wc -l X-Patchwork-Id: 11244653 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 3E315138C for ; Fri, 15 Nov 2019 01:01:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EE0720725 for ; Fri, 15 Nov 2019 01:01:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M3fpAb6b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727428AbfKOBB1 (ORCPT ); Thu, 14 Nov 2019 20:01:27 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42848 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbfKOBB1 (ORCPT ); Thu, 14 Nov 2019 20:01:27 -0500 Received: by mail-pf1-f196.google.com with SMTP id s5so5458056pfh.9 for ; Thu, 14 Nov 2019 17:01:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=inLt0QKoeIphXL/Ze1gMz2SKfhZ6e4mcP429R5zsWDI=; b=M3fpAb6b4JXMhRO1lZXbSBUbJkxHR7RaYPs0MmT91c0XhxMz4LNL9xn2fXawp8mLEs 52AolrpNJoE7B8rIyYnXuJn2mT0Cks36IkZWuBkZRa43iJ98ZXXMQjmh4JexPQI0Pufd N+zSURoWnuL92RSsSX7QsOn0Ei/jhH4g+Aww3zioXGRuJ5ceK8cDFJGyjdI6/+N6Hhj1 D2DpRtcvNy5/uWrxancb/4u4qyDUjuMX3VMNus/PwTsVy/4wPkiAo3bGZmMWc4KlRSNb eGdEdIH3aaTLMdASUu7QCvJqiqvbIEvBaI9tYxZMXqmN8GPJqBNRQrdBwxBur9tuWFQN qWQg== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=inLt0QKoeIphXL/Ze1gMz2SKfhZ6e4mcP429R5zsWDI=; b=p+dXK3+vqib7mdKgNMFwmFP6oQ3bZyknkFwkbZ1Knwa+p2N0xaf5JeZICcGExytg51 MtGvqDh45SqB6hEyixbiOzRuaMEdafFh2A54Bitdos3kgfvI0vgVcSX7uDCnm76RtkCb nL093YdWzcMd+kILZa14p7bJmE1q8Zvh06dci8oiMUS5LggdxBPmn8kC7C1IRFF4wxce M2AxP8LoZJrTLbgDAwYDZ4GridoOJQ+45Qp8pbaeHIei2+4YvrX0UchOeoSN3eMPps7o ku4W+95jaG5mmF3CxZpc4AqbI7YBByEPHxks4GXi/6TRVCiXOT+CUP3j1PnRy6JXuZ4B L0ng== X-Gm-Message-State: APjAAAW8tCFfOWG0xtfxKVhYpbwXKWnizU/jX1P/0hpSluw9osRALB5E WCbOB8d51d9sJx8K0/6nhXFKZY/a X-Google-Smtp-Source: APXvYqzz1k/u3/D668U7CC1QUyoDAgTTj6111JcNOyEPNrnIVrE4k8O+BkTgB+lIszQPRVBKS+VVVA== X-Received: by 2002:a63:e84d:: with SMTP id a13mr13124967pgk.226.1573779686089; Thu, 14 Nov 2019 17:01:26 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id z4sm7756365pfn.80.2019.11.14.17.01.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:25 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:24 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 23/27] t3600: mark git command as failing Message-ID: References: MIME-Version: 1.0 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 future patch, we plan on running tests with `set -o pipefail`. Since we intentionally induce SIGPIPE, before the return code was being masked away. However, now `git rm` will cause an error code to be returned because of the SIGPIPE. Mark the failing command with `test_must_fail ok=sigpipe` so that failures induced by SIGPIPE don't propogate. Signed-off-by: Denton Liu --- t/t3600-rm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 0ea858d652..d1b3703edb 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -252,7 +252,7 @@ test_expect_success 'choking "git rm" should not let it die with cruft' ' i=$(( $i + 1 )) done | git update-index --index-info && # git command is intentionally placed upstream of pipe to induce SIGPIPE - git rm -n "some-file-*" | : && + test_must_fail ok=sigpipe git rm -n "some-file-*" | : && test_path_is_missing .git/index.lock ' From patchwork Fri Nov 15 01:01:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244655 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 DE5FC138C for ; Fri, 15 Nov 2019 01:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF09220727 for ; Fri, 15 Nov 2019 01:01:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NFZJjJbD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727432AbfKOBBa (ORCPT ); Thu, 14 Nov 2019 20:01:30 -0500 Received: from mail-pl1-f179.google.com ([209.85.214.179]:45658 "EHLO mail-pl1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbfKOBB3 (ORCPT ); Thu, 14 Nov 2019 20:01:29 -0500 Received: by mail-pl1-f179.google.com with SMTP id w7so3475896plz.12 for ; Thu, 14 Nov 2019 17:01:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=w93ahQ5uHbsYV8T52XPLXv9KtWvrd4ndaT3MCfGhWHI=; b=NFZJjJbD9EAg2F3RyOHmj7Ub8ro2/hLISdQgpaDuraqc5v5TMTCeOgHK+E2JFM6Cst Y/Q/CsBMm9y+W3hbNVqCwyd2lartqdHFdUKbrVoULHlAVRPi6Z+Dq2NT42vs0+8Pv//0 GhkzChs/CJkN6W37uo+CWZT7YwNtuheiOTPip24fgFg32IPFKGdQ1WqMDOwtynR8p+fB fNB5iK6PV5CYhfZEHAQ0xvCHMJVKdGpCbkI9oWGzkYwTcxh3PqDTRYy47NLz7i2Vqzmu jNRzLxyOGBEj/mkj/km/3iO++5iDLgVlaAZH8EdiRN5yFevNLR3PSfwrKr+al/TCKPWj 2ceQ== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=w93ahQ5uHbsYV8T52XPLXv9KtWvrd4ndaT3MCfGhWHI=; b=NLjJGDRQ9bySnGilcBX9lK9hY3viJhEq0LlLFYuzKZnhd163OmDo6IiHx6KTulbs6h NhZZiHqgv3KAP4IHwPBD7Z7G0COK0NJ9uqkauRQ5a+MOV4SIlVZBYZlhQZ+7i2xx8NRt 7RO0/zY90gEvo8z6VjTqG3y+yNsTuVQOApJjAoEUSwhzdaAkgqa+OD9kXKsQnZ5J+n81 zxdUJp59svCAhpqjTcP+qFUOxHtUg1WYOF5pJLZMXUPo31zc3Fb+osD4hRGxs/CPr3+H FFQaxmSYsvi3B/UhtAtg0rbpy7kzcjP2hOfMviHVtO8BxwZirakiNTYTQJo3QWYkY6HP aj0A== X-Gm-Message-State: APjAAAXwdUB+AQiOMCND5dbLONkkWhp2EOQrUNyg2DwF5tEndA0MRXny y12Zj3TIrKFk7b2B9QHfOF2CQWH8 X-Google-Smtp-Source: APXvYqwzJGavNqx2Lz41IQnVTFj1+Z/MVG/Qt0slQnxFXBuceUle3kMyGkLmscv2fHkmY/nZio2yzg== X-Received: by 2002:a17:902:7c03:: with SMTP id x3mr12234676pll.157.1573779688248; Thu, 14 Nov 2019 17:01:28 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id v10sm7521489pfg.11.2019.11.14.17.01.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:27 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:26 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 24/27] t5004: ignore SIGPIPE in zipinfo Message-ID: References: MIME-Version: 1.0 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 future patch, we plan on running tests with `set -o pipefail`. Since zipinfo is killed by SIGPIPE, it will return an error code which will propogate as a result of the pipefail. Mask away the return code of zipinfo so that the failure as a result of the SIGPIPE does not propogate. Signed-off-by: Denton Liu --- t/t5004-archive-corner-cases.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh index 3e7b23cb32..4c6d42d474 100755 --- a/t/t5004-archive-corner-cases.sh +++ b/t/t5004-archive-corner-cases.sh @@ -153,7 +153,9 @@ test_expect_success ZIPINFO 'zip archive with many entries' ' # check the number of entries in the ZIP file directory expr 65536 + 256 >expect && - "$ZIPINFO" many.zip | head -2 | sed -n "2s/.* //p" >actual && + { + "$ZIPINFO" many.zip || : + } | head -2 | sed -n "2s/.* //p" >actual && test_cmp expect actual ' From patchwork Fri Nov 15 01:01:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244657 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 F2E99930 for ; Fri, 15 Nov 2019 01:01:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D388220725 for ; Fri, 15 Nov 2019 01:01:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IDImvDZI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727435AbfKOBBc (ORCPT ); Thu, 14 Nov 2019 20:01:32 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37509 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbfKOBBb (ORCPT ); Thu, 14 Nov 2019 20:01:31 -0500 Received: by mail-pg1-f196.google.com with SMTP id z24so4900922pgu.4 for ; Thu, 14 Nov 2019 17:01:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5Q7H3cXmcRuFkQWI3FdwJ/pbVf5wb7wm0nF8kPSimDw=; b=IDImvDZIiZHM608PnQ7mAk+Zzbxn+S3u5moleakLStXW0SRbigEaFAnWaXRuLPGIFF L9uLmVhJK2ey06qM+edo2OuewyzOI3OIx0A7KmBC269nVEQexjX74zj9rbQRoGNcBRry DjBOWy2OThZVoL8e0GFpAcmsxhNL3zZ3YUJZY3n3Q/GcUJPGVbtzSS3QokjF5gReUGKL 7eZbHGThUSCei3owEyfD1m1o2LQ4HuOaZXxg7JLzFAwCSHD4zpdvAxBtbkvPcKd0Nnkr FTANbLTygLYyqBxWGe+52mhwa3OI5c0gt/cKuts74IXztEuEOqyIgThXKM7EOI91Z5hy Hc2w== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5Q7H3cXmcRuFkQWI3FdwJ/pbVf5wb7wm0nF8kPSimDw=; b=tAYrwiDYDcR46gmu+XtgQpA8BXm5huLVGY/iJRow5mFja++nLLNQCT9hljHl8RrPyW 4FaShumaqIqAPf1J3bpSpxPQnevxhHJAH4a2Osf/29P16kXiQN5+uIeuj548aTpEKXm7 4prqLBaDzxxr1e8VvWZbX0Q4aMaHVa5R0epAY9zOoTVVLY0PHIBXUqjAt74/Cma3G5fq EZapHHr2+nzx7nRCdflxjRfCpoA6bmnZ9EZ4DQMiSv1OXDwRnNtZv8wj6iKLKIQM20Iv ZUtu1WXmVyy7XskzvHYtlX3/6XK4O2i//dpZiXnz8alKOe7Qw7u1Lgj0ez5Cp47WlAcU Pg3g== X-Gm-Message-State: APjAAAU8D4GaC4Q3C0umOKIVEKWq8/PXkCHStN8j6N2Pu6B/2RXi2g+v obxfJKGvN4rwaWf4i8SE0NFr1vcG X-Google-Smtp-Source: APXvYqw10Eou/HPsax6E6/QPvy3saJO/prrK5Lt2VcOVjOXoW142WAIFFq68/gEjW+E0tSgzM1XZJw== X-Received: by 2002:a17:90a:fa02:: with SMTP id cm2mr15345178pjb.141.1573779690336; Thu, 14 Nov 2019 17:01:30 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id z63sm7707771pgb.75.2019.11.14.17.01.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:29 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:28 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 25/27] t5703: mask failing grep status Message-ID: References: MIME-Version: 1.0 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 future patch, we plan on running tests with `set -o pipefail`. However, since grep can return failure in the case that no lines are matched, this can trigger a failure in a pipe in the case where grep is being used as a filter. Use test_grep_return_success() instead of grep so that we don't fail even if we have no matching lines. Signed-off-by: Denton Liu --- t/t5703-upload-pack-ref-in-want.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh index 9f6d837720..c4f9698398 100755 --- a/t/t5703-upload-pack-ref-in-want.sh +++ b/t/t5703-upload-pack-ref-in-want.sh @@ -19,7 +19,7 @@ get_actual_commits () { }' o.pack && git index-pack o.pack && git verify-pack -v o.idx >objs && - grep commit objs | cut -c-40 | sort >actual_commits + test_grep_return_success commit objs | cut -c-40 | sort >actual_commits } check_output () { From patchwork Fri Nov 15 01:01:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244659 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 CD95C138C for ; Fri, 15 Nov 2019 01:01:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE92820729 for ; Fri, 15 Nov 2019 01:01:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BE/epLgd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727403AbfKOBBe (ORCPT ); Thu, 14 Nov 2019 20:01:34 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38476 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727437AbfKOBBd (ORCPT ); Thu, 14 Nov 2019 20:01:33 -0500 Received: by mail-pl1-f195.google.com with SMTP id w8so3487720plq.5 for ; Thu, 14 Nov 2019 17:01:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VjJogdhR5BS13cyYeMoZljc4gDWzfmfdKUgXYp6WRsk=; b=BE/epLgdlUlqvHmqRJl/sx91f4f43RlNXz+I3av/RPJanjtT4FjfKMwffjqu3qhsBX tcH3fpy8NUpfTjYvhTtRAXzJ2IXWaqx3Zy8VdLGJCIBuwXLTza224adrvv0roEMMkOtB VPeEysTE4a2LWYqtTdAE+mrHt9c5fpYbZdIeURiQI6+WV8HrdnReaCcAffD7q6vuOTcp rBHfNIIEaQxoFNTgiacr5ETrHiUXePFQCof9UHI/Oj4WCJLp4s8oQCYKwXRfXCKiwaSi 63e2khnpXECTpgzZuLubQk5OJHJLFFibX0KeKs4H9nbsOhOJNobUddYnbnnmxWkjEU4u 9tJA== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VjJogdhR5BS13cyYeMoZljc4gDWzfmfdKUgXYp6WRsk=; b=KQypCHRbWxzT4TrcT8jD8tEn7FKsUPZSaAvjTHsZn6nKepDKGhe/pKuP+Nfcsg+Ka6 ID7sAICY6wzUTr3UCUvRpVK2vDULQmC5cDhcPju0fCAxOrQKBvkYw49PEB8oBBG5uDzA 04KBajZjdnkWXFi+LnT59t8GV4z/j4XAwDR+ZDVfvffrSgVd6cTOzeWf/br5gWen/WDW wguWhoxX8Baa1VmiSh+du953wg8jgRPomaPlu3zWOpUU4jKATXF84dK3d2hSyE/5nywA oV9zw+MsC0awOXJYzBP6N0XLAj9x5EKCqSV4fjdBlFAyZFcwVuoD8d2LCY+bwQYcNqXa sDeA== X-Gm-Message-State: APjAAAUL0e6QmGnlU2EE+oa0a9bm5xUJJMEBwP58my3X0+QIHGk8iSbe +seG5BLrHWeovTbYx1TidxjD4s7u X-Google-Smtp-Source: APXvYqyP4JoWC4I0ddGEhuKbcWXTQV+rcc9oAHz8fjGDjNb49FiieHv0MIQGB8CC+3zHJLvCucfojw== X-Received: by 2002:a17:902:ac98:: with SMTP id h24mr12122560plr.227.1573779692385; Thu, 14 Nov 2019 17:01:32 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id 71sm8688760pfx.107.2019.11.14.17.01.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:31 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:30 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 26/27] t9902: disable pipefail Message-ID: <95806f55e7e0ad1ac187ea162a74d5883fa86e67.1573779466.git.liu.denton@gmail.com> References: MIME-Version: 1.0 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 future patch, we plan on running tests with `set -o pipefail`. However, these tests cannot run with pipefail. Since git-completion.bash is not a testing script, it does not follow the same return code conventions and it's expected that commands can fail within a pipeline. Run `set +o pipefail` to disable pipefail in this script. Note that this is being unconditionally run because this test will be skipped if its not running on Bash. Signed-off-by: Denton Liu --- t/t9902-completion.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index e90ac565e1..75a512669e 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -7,6 +7,12 @@ test_description='test bash completion' . ./lib-bash.sh +# These tests cannot run with pipefail. Since git-completion.bash is not +# a testing script, it does not follow the same return code conventions +# and it's expected that commands can fail within a pipeline. Ignore +# these failures. +set +o pipefail + complete () { # do nothing From patchwork Fri Nov 15 01:01:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11244661 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 22ADC138C for ; Fri, 15 Nov 2019 01:01:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01E2220672 for ; Fri, 15 Nov 2019 01:01:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="thfDisuu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727443AbfKOBBg (ORCPT ); Thu, 14 Nov 2019 20:01:36 -0500 Received: from mail-pl1-f182.google.com ([209.85.214.182]:36179 "EHLO mail-pl1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727437AbfKOBBf (ORCPT ); Thu, 14 Nov 2019 20:01:35 -0500 Received: by mail-pl1-f182.google.com with SMTP id d7so3492802pls.3 for ; Thu, 14 Nov 2019 17:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qKGS2OrEcED1RzyPy3C6YamwGH2Inz95+8BYXXiBZVM=; b=thfDisuupJPFtkcbClcf18dA7c3TtKNgvaXdYSTwS7n/AbtCoYmryZ9pCwRPAGg5MX FQwNT56xC2neBK1Z3tukGqhg31+sPxEpX+ny4mF5bXzcXo/Tda/sKCnk3MYVCQFXSfzJ A/2wyN3BetgBqyBa1UJRK9KeVU2VKn2vCCJ/nrNg5ZJ9LuEf66InIHLx42Y1evh/kLSh 89rIp/ww4BQr4EUk3TujJuXKoh37EozzYRwbiFyeYYayh39hKRlMnycDsXoucktJjjQn zZWIsuBhGQTGNQ/hE3gQslH9ovrO54YcZxDWoxO9jVJYJWbDxUppm6Lfglacaza6VG6o qSnw== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qKGS2OrEcED1RzyPy3C6YamwGH2Inz95+8BYXXiBZVM=; b=HlIug6JHdN6P3Pcmj6IF1q/2Z5uUN7+NFmOXGTgMRGTZlmV/YDvKCUNtNaGc+YvxZ4 MujsN/YoC/BX8exjItVNwmAu4EWaLIM2FAEtUM+UKgSap9JN+nIxMDRb5/gHk1ihJwLD Ph7G+w6ZEgk828ymC+Z2oxASKmSTCMGiAOOr2fTfMT15mO/GuqrWKnyZmz/Q+1gscEVA zocBtvaE/dc+jkAHNBuVHfM94ZMp24T/LTn9iZW+BUcORSSRN1cpb6JBw+bPWdLBFobN S9Cit7wDBYEjdNshjYxMiuoV1zQ3wo/yxwT/P46B/YVd5HHuSz9ffM3SN8IhsFMiVUOp /cFw== X-Gm-Message-State: APjAAAXDC1twmL5F8EqYAw4gvgSo7Rm8/igifM6VzxSWN7K4LVW2GsjN DlaUNUWSum8xWT8CVBlqwQK8w5oS X-Google-Smtp-Source: APXvYqw8/SA0gvqBzmqboASf6rMFt3j3hVhX3ZAkZ3RuQgvgj1fj4Rsw775DYO7t4qUg5qXYgVjhdg== X-Received: by 2002:a17:90a:dd42:: with SMTP id u2mr14454156pjv.57.1573779694605; Thu, 14 Nov 2019 17:01:34 -0800 (PST) Received: from generichostname ([204.14.239.54]) by smtp.gmail.com with ESMTPSA id 12sm8529447pfv.92.2019.11.14.17.01.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 17:01:34 -0800 (PST) Date: Thu, 14 Nov 2019 17:01:32 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 27/27] t: run tests with `set -o pipefail` on Bash Message-ID: References: MIME-Version: 1.0 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 The current convention is to ensure that git commands are not placed in the upstream of a pipe. If they are, they could fail in an undetectable manner since a pipe's return code is the last command in the pipe. However, many old tests are still written with git commands in the upstream of a pipe. In the spirit of catching these failures, run tests with `set -o pipefail` if the underlying shell is Bash. This way, we can catch failures of Git commands that may occur even in the middle of a pipeline. In the future, more shells that support `set -o pipefail` may have it enabled but let's start small for now. Signed-off-by: Denton Liu --- t/README | 4 ++++ t/test-lib.sh | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/t/README b/t/README index 60d5b77bcc..ba96b6d113 100644 --- a/t/README +++ b/t/README @@ -415,6 +415,10 @@ GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS=, when true (which is the default when running tests), errors out when an abbreviated option is used. +GIT_TEST_PIPEFAIL=, when true, run 'set -o pipefail' to catch +failures in commands that aren't the last in a pipe. Defaults to true on +Bash and false otherwise. + Naming Tests ------------ diff --git a/t/test-lib.sh b/t/test-lib.sh index 46c4440843..c0c43dfce9 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -64,6 +64,18 @@ then export GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS fi +# Use set -o pipefail on platforms that support it +GIT_TEST_PIPEFAIL_DEFAULT=false +# TODO: detect more platforms that support `set -o pipefail` +if test -n "$BASH_VERSION" +then + GIT_TEST_PIPEFAIL_DEFAULT=true +fi +if git env--helper --type=bool --default="$GIT_TEST_PIPEFAIL_DEFAULT" --exit-code GIT_TEST_PIPEFAIL +then + set -o pipefail +fi + ################################################################ # It appears that people try to run tests without building... "${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git$X" >/dev/null