From patchwork Mon Oct 7 15:32:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usman Akinyemi X-Patchwork-Id: 13824927 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 810E31D2714 for ; Mon, 7 Oct 2024 15:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315131; cv=none; b=lJUkokq5D0oRBSXDFzOQoJYeA4Fh3YhkggRTivkrkAnZvucQhHaz22lRiYXkES6QkaAjpHuXu+CHN5HhNEw8oJtfBzYjBwpQ8UiZteBCo8ibQg44dDx6cq2lJul0s4wP1zpxm3Gz2PiS6KDgBNXM1EcFutEIIy4VCiUsAsn/PNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315131; c=relaxed/simple; bh=8X7AYbIkdi6HWMJsOn8WL8bQ8PJ1PdePDY/MmQ8HcQA=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=PQ1/v2RyskrBhCjHKKMIY0Pf5UJExZLIIal08BwYVJow4z3A+dVj+uoUSut1zNjF4BGtfGzbM613zcbvdCLEbqeg782WF0jRv8A2xbTv0xP2CJCoxrsAktdHGIhIa5jtIkqr7zhexLgSmIB0JDOUbOAm+zWxfqYpHE7cYooOoOU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Q+IQlPtj; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q+IQlPtj" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5389e24a4d1so5528399e87.3 for ; Mon, 07 Oct 2024 08:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728315127; x=1728919927; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=eDnWYjNHpEFCxbMSFSMnpDZIaC6pxr1AJpOo0w99cRM=; b=Q+IQlPtjUpnAxA2vSgpwuyt4QiALcy7lhu3pNjc4HY6AH0N8hYZ0WLjHdm2iatV4xa htQdk5pQFU4S7nPbS+JvSyBquuKqzSlRvqYCINuaZmGdHMdcjqN8mWBsr5W3stgvJ5O0 9ChFYq67PlMcqWDLiv1AmAV67jFVJbtfF/6379JSxbY3zYCZH9AjOk1O9h4sQOrKYGzo 4/uP7pHqQnXEnbQzODMqE+uQFhV9AvikPLJthiqMHMgp6m3nsPbi3mTY9wzje8DfINTw yXMLhDCDIcYzQolvLbL/Yhcd0mt5UI9RRgxvbEgn54ACMNCvr4wl/x6N9UpI1q9kTFqQ /71Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728315127; x=1728919927; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eDnWYjNHpEFCxbMSFSMnpDZIaC6pxr1AJpOo0w99cRM=; b=H56rs2mMnccRKfGmR2ygesNqa8yX0iK7UR/1I0LN2JR1lrztctst6sEsaRKv8FyILq vl/sKVeeCv+BC+FNfb6DnhL3QXK1CB75nolF2Du11Kf7SsL3VfqE/eTJkVUDnyHkckcM DNKfEq+WHYXiaHohp5S/cHFzb/G9akDY9X6xBd8B8vBYrD+TJrNRvP/ZOYlgJgdiFLEG +NoN9iMcEjht/8Wl7+P/niNR7E2moRqWIxXUtD45Ij82DTugTCY8edgugBoZpMmQEndT L7StGbGb9BtA4msUd8d2IoW9QxtvD/CmaHny541gQNWTxMEZocTwV91SPN31aQZmfOzt N1+Q== X-Gm-Message-State: AOJu0Yxfoj9S9SM+Wh0WKlHo8PJUtrbA0xjTjIAQswFulY/+TXraYR2C XCeKvUy3E+j89HyWUWPlsSkPMDkQSWbEDFSjSC1+LN2JCo+Zpc2Jd+fdJQ== X-Google-Smtp-Source: AGHT+IFa4dnWg9mpvtx6Yl5MgX5UuCB0bYcaleKTxUrfrAp2sHoDRwiCsvwjs8GnyZpJx+22axgxSw== X-Received: by 2002:a05:6512:3d0c:b0:533:455c:8a49 with SMTP id 2adb3069b0e04-539ab8adbccmr5601239e87.38.1728315126950; Mon, 07 Oct 2024 08:32:06 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9954cd8395sm149106266b.30.2024.10.07.08.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 08:32:06 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 07 Oct 2024 15:32:02 +0000 Subject: [PATCH v7 1/2] t3404: avoid losing exit status with focus on `git show` and `git cat-file` Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: Patrick Steinhardt , Phillip Wood , Usman Akinyemi , Usman Akinyemi From: Usman Akinyemi From: Usman Akinyemi The exit code of the preceding command in a pipe is disregarded. So if that preceding command is a Git command that fails, the test would not fail. Instead, by saving the output of that Git command to a file, and removing the pipe, we make sure the test will fail if that Git command fails. This particular patch focuses on all `git show` and some instances of `git cat-file`. Signed-off-by: Usman Akinyemi --- t/t3404-rebase-interactive.sh | 71 +++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index f171af3061d..96a65783c47 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -319,7 +319,8 @@ test_expect_success 'retain authorship' ' GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" && git tag twerp && git rebase -i --onto primary HEAD^ && - git show HEAD | grep "^Author: Twerp Snog" + git show HEAD >actual && + grep "^Author: Twerp Snog" actual ' test_expect_success 'retain authorship w/ conflicts' ' @@ -360,7 +361,8 @@ test_expect_success 'squash' ' ' test_expect_success 'retain authorship when squashing' ' - git show HEAD | grep "^Author: Twerp Snog" + git show HEAD >actual && + grep "^Author: Twerp Snog" actual ' test_expect_success '--continue tries to commit' ' @@ -374,7 +376,8 @@ test_expect_success '--continue tries to commit' ' FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue ) && test_cmp_rev HEAD^ new-branch1 && - git show HEAD | grep chouette + git show HEAD >actual && + grep chouette actual ' test_expect_success 'verbose flag is heeded, even after --continue' ' @@ -397,7 +400,9 @@ test_expect_success 'multi-squash only fires up editor once' ' git rebase -i $base ) && test $base = $(git rev-parse HEAD^) && - test 1 = $(git show | grep ONCE | wc -l) + git show >output && + count=$(grep ONCE output | wc -l) && + test 1 = $count ' test_expect_success 'multi-fixup does not fire up editor' ' @@ -410,7 +415,9 @@ test_expect_success 'multi-fixup does not fire up editor' ' git rebase -i $base ) && test $base = $(git rev-parse HEAD^) && - test 0 = $(git show | grep NEVER | wc -l) && + git show >output && + count=$(grep NEVER output | wc -l) && + test 0 = $count && git checkout @{-1} && git branch -D multi-fixup ' @@ -428,7 +435,9 @@ test_expect_success 'commit message used after conflict' ' git rebase --continue ) && test $base = $(git rev-parse HEAD^) && - test 1 = $(git show | grep ONCE | wc -l) && + git show >output && + count=$(grep ONCE output | wc -l) && + test 1 = $count && git checkout @{-1} && git branch -D conflict-fixup ' @@ -446,7 +455,9 @@ test_expect_success 'commit message retained after conflict' ' git rebase --continue ) && test $base = $(git rev-parse HEAD^) && - test 2 = $(git show | grep TWICE | wc -l) && + git show >output && + count=$(grep TWICE output | wc -l) && + test 2 = $count && git checkout @{-1} && git branch -D conflict-squash ' @@ -470,10 +481,10 @@ test_expect_success 'squash and fixup generate correct log messages' ' ) && git cat-file commit HEAD | sed -e 1,/^\$/d > actual-squash-fixup && test_cmp expect-squash-fixup actual-squash-fixup && - git cat-file commit HEAD@{2} | - grep "^# This is a combination of 3 commits\." && - git cat-file commit HEAD@{3} | - grep "^# This is a combination of 2 commits\." && + git cat-file commit HEAD@{2} >actual && + grep "^# This is a combination of 3 commits\." actual && + git cat-file commit HEAD@{3} >actual && + grep "^# This is a combination of 2 commits\." actual && git checkout @{-1} && git branch -D squash-fixup ' @@ -489,7 +500,9 @@ test_expect_success 'squash ignores comments' ' git rebase -i $base ) && test $base = $(git rev-parse HEAD^) && - test 1 = $(git show | grep ONCE | wc -l) && + git show >output && + count=$(grep ONCE output | wc -l) && + test 1 = $count && git checkout @{-1} && git branch -D skip-comments ' @@ -505,7 +518,9 @@ test_expect_success 'squash ignores blank lines' ' git rebase -i $base ) && test $base = $(git rev-parse HEAD^) && - test 1 = $(git show | grep ONCE | wc -l) && + git show >output && + count=$(grep ONCE output | wc -l) && + test 1 = $count && git checkout @{-1} && git branch -D skip-blank-lines ' @@ -572,7 +587,8 @@ test_expect_success '--continue tries to commit, even for "edit"' ' FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue ) && test edited = $(git show HEAD:file7) && - git show HEAD | grep chouette && + git show HEAD >actual && + grep chouette actual && test $parent = $(git rev-parse HEAD^) ' @@ -757,19 +773,23 @@ test_expect_success 'reword' ' set_fake_editor && FAKE_LINES="1 2 3 reword 4" FAKE_COMMIT_MESSAGE="E changed" \ git rebase -i A && - git show HEAD | grep "E changed" && + git show HEAD >actual && + grep "E changed" actual && test $(git rev-parse primary) != $(git rev-parse HEAD) && test_cmp_rev primary^ HEAD^ && FAKE_LINES="1 2 reword 3 4" FAKE_COMMIT_MESSAGE="D changed" \ git rebase -i A && - git show HEAD^ | grep "D changed" && + git show HEAD^ >actual && + grep "D changed" actual && FAKE_LINES="reword 1 2 3 4" FAKE_COMMIT_MESSAGE="B changed" \ git rebase -i A && - git show HEAD~3 | grep "B changed" && + git show HEAD~3 >actual && + grep "B changed" actual && FAKE_LINES="1 r 2 pick 3 p 4" FAKE_COMMIT_MESSAGE="C changed" \ git rebase -i A ) && - git show HEAD~2 | grep "C changed" + git show HEAD~2 >actual && + grep "C changed" actual ' test_expect_success 'no uncommitted changes when rewording and the todo list is reloaded' ' @@ -1003,8 +1023,10 @@ test_expect_success 'rebase -i --root retain root commit author and message' ' set_fake_editor && FAKE_LINES="2" git rebase -i --root ) && - git cat-file commit HEAD | grep -q "^author Twerp Snog" && - git cat-file commit HEAD | grep -q "^different author$" + git cat-file commit HEAD >output && + grep -q "^author Twerp Snog" output && + git cat-file commit HEAD >actual && + grep -q "^different author$" actual ' test_expect_success 'rebase -i --root temporary sentinel commit' ' @@ -1013,7 +1035,8 @@ test_expect_success 'rebase -i --root temporary sentinel commit' ' set_fake_editor && test_must_fail env FAKE_LINES="2" git rebase -i --root ) && - git cat-file commit HEAD | grep "^tree $EMPTY_TREE" && + git cat-file commit HEAD >actual && + grep "^tree $EMPTY_TREE" actual && git rebase --abort ' @@ -1036,7 +1059,8 @@ test_expect_success 'rebase -i --root reword original root commit' ' FAKE_LINES="reword 1 2" FAKE_COMMIT_MESSAGE="A changed" \ git rebase -i --root ) && - git show HEAD^ | grep "A changed" && + git show HEAD^ >actual && + grep "A changed" actual && test -z "$(git show -s --format=%p HEAD^)" ' @@ -1048,7 +1072,8 @@ test_expect_success 'rebase -i --root reword new root commit' ' FAKE_LINES="reword 3 1" FAKE_COMMIT_MESSAGE="C changed" \ git rebase -i --root ) && - git show HEAD^ | grep "C changed" && + git show HEAD^ >actual && + grep "C changed" actual && test -z "$(git show -s --format=%p HEAD^)" ' From patchwork Mon Oct 7 15:32:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usman Akinyemi X-Patchwork-Id: 13824928 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3FAB1D7E3D for ; Mon, 7 Oct 2024 15:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315131; cv=none; b=Qd6fq1aGaPrNiJm6hef4nIiznFZ4HH3FypmqDzREf+leGRep7L8WExRaJXg3jaZR+0SiIDKgiLgAC11+H0/BdZ3V1BuwQlQEglPqY/iLCz5V+Qe7UrxycngyoIux8KBaUBhndxzniRYX1rtKWFrerGShTDsqJMRFM5aH5L4Oeps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728315131; c=relaxed/simple; bh=QiL+XQMXI9+QVUPG8YvRTi9B+M+EDHuwj+mxNg8SJDo=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=Nf9MHDjFAaISHnm3MBgBTEWoL6mbobXf/VUin7aDOJsukmKnI9k9pPKXsXtnZOOEmUySgTcuEaAnk/qxj6R9zRGJq8gsgJjUfwB9SMhmM0pzDaGwEZIDbwadqH5qY7AyWQ6K17qJSM7NuFvz3Za6YnDSQSTJ0+tOvPnH0iJ4+hs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V2qDZ4Bc; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V2qDZ4Bc" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a994c322aefso247285066b.1 for ; Mon, 07 Oct 2024 08:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728315128; x=1728919928; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=D2i3Q1aTCZLQZNTzPO6oISTv/cdcApWY4GY97NPGCzY=; b=V2qDZ4BczSileGDl+/khhTxEvaUVn6TO4Ok8j7ixbFI/hsuzX8ctMaqXw5Lqna5ZXS yG8RN80lkPad1gpgLvxTb788On65lZoutfi6Zv3+Yv9ideDVMB+guqNqMBglL2QX1ghV kmZa+gY7fxzqBTkaE78xnjGvZ9v6DrR926zgQqNZAxy4im2k8HKEs7zal24Dair3vDDd o2fQS7AtRTAQtgI9dfE4hXi+N0V+wqRdaQlWyBFai00LyAYuOcE5x14sW7LOK24jHBRb ZmJJ4VAu5pxchqh2EmaQjwmRmohkdsUbpyaRd+Ob4rY9kpdG2rKmws/vYzYBhAVJVor7 8QuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728315128; x=1728919928; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D2i3Q1aTCZLQZNTzPO6oISTv/cdcApWY4GY97NPGCzY=; b=uVWDIwTZDumHtjClY67OFsNHFjj5J79yKs/X0Z9+CmUIdVBPAspcf5F6/bV284URB7 jkVgM0r105p0D2nV5L4NFudWzqpOvl5XNgDELbpCj9EhaDXHl0ES33SxIF1bXGQW2hlY mVOiE+xiShkJqNnSFHSRMlbh2z5+AOScj4jIJIirtFNikOwzqj0EEK//UCfCpoh5WFuZ 2yrY0Cp9jXFXg4ySpqyQ7/Q0OtuJPza1fyCWWIt3xYEissI+8+YqhvwTaWf3lPevrFOE sLTM4tQAuDDH2Hweaf8AQe8Hy1A46Y/fhLSR/IVV4/Tg4BKOubvg0yVt8LwMNV7E+C5H Hkbw== X-Gm-Message-State: AOJu0Ywqsohuy8IBGmNzeYUI6xvKDIbS5MU1aA3PXXU0VhVilaNuGHIM UE/QeVg9hyxzTEtuYtQO8n4hwRl6Ih72vjLrqVRQ1X3nxVwHpPa66gcMag== X-Google-Smtp-Source: AGHT+IEMeU1HBEa8I2WhX4iW2t4DXFyFedetBjkKuffZKr25LugggkX1FZ1mFYQTs9OjeR9ixdrpIg== X-Received: by 2002:a17:906:ee82:b0:a8d:2281:94d9 with SMTP id a640c23a62f3a-a990a21d61emr1922861866b.23.1728315127745; Mon, 07 Oct 2024 08:32:07 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a992e5d0a32sm399605266b.19.2024.10.07.08.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 08:32:07 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 07 Oct 2024 15:32:03 +0000 Subject: [PATCH v7 2/2] t3404: replace test with test_line_count() Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: Patrick Steinhardt , Phillip Wood , Usman Akinyemi , Usman Akinyemi From: Usman Akinyemi From: Usman Akinyemi Refactor t3404 to replace instances of `test` with `test_line_count()` for checking line counts. This improves readability and aligns with Git's current test practices. Signed-off-by: Usman Akinyemi --- t/t3404-rebase-interactive.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 96a65783c47..2ab660ef30f 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -281,8 +281,9 @@ test_expect_success 'stop on conflicting pick' ' test_cmp expect2 file1 && test "$(git diff --name-status | sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 && - test 4 = $(grep -v "^#" < .git/rebase-merge/done | wc -l) && - test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo) + grep -v "^#" <.git/rebase-merge/done >actual && + test_line_count = 4 actual && + test 0 = $(grep -c "^[^#]" <.git/rebase-merge/git-rebase-todo) ' test_expect_success 'show conflicted patch' ' @@ -401,8 +402,8 @@ test_expect_success 'multi-squash only fires up editor once' ' ) && test $base = $(git rev-parse HEAD^) && git show >output && - count=$(grep ONCE output | wc -l) && - test 1 = $count + grep ONCE output >actual && + test_line_count = 1 actual ' test_expect_success 'multi-fixup does not fire up editor' ' @@ -416,8 +417,7 @@ test_expect_success 'multi-fixup does not fire up editor' ' ) && test $base = $(git rev-parse HEAD^) && git show >output && - count=$(grep NEVER output | wc -l) && - test 0 = $count && + ! grep NEVER output && git checkout @{-1} && git branch -D multi-fixup ' @@ -436,8 +436,8 @@ test_expect_success 'commit message used after conflict' ' ) && test $base = $(git rev-parse HEAD^) && git show >output && - count=$(grep ONCE output | wc -l) && - test 1 = $count && + grep ONCE output >actual && + test_line_count = 1 actual && git checkout @{-1} && git branch -D conflict-fixup ' @@ -456,8 +456,8 @@ test_expect_success 'commit message retained after conflict' ' ) && test $base = $(git rev-parse HEAD^) && git show >output && - count=$(grep TWICE output | wc -l) && - test 2 = $count && + grep TWICE output >actual && + test_line_count = 2 actual && git checkout @{-1} && git branch -D conflict-squash ' @@ -501,8 +501,8 @@ test_expect_success 'squash ignores comments' ' ) && test $base = $(git rev-parse HEAD^) && git show >output && - count=$(grep ONCE output | wc -l) && - test 1 = $count && + grep ONCE output >actual && + test_line_count = 1 actual && git checkout @{-1} && git branch -D skip-comments ' @@ -519,8 +519,8 @@ test_expect_success 'squash ignores blank lines' ' ) && test $base = $(git rev-parse HEAD^) && git show >output && - count=$(grep ONCE output | wc -l) && - test 1 = $count && + grep ONCE output >actual && + test_line_count = 1 actual && git checkout @{-1} && git branch -D skip-blank-lines '