From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id E265A1F463 for ; Tue, 26 Nov 2019 01:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727254AbfKZBSV (ORCPT ); Mon, 25 Nov 2019 20:18:21 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34669 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725946AbfKZBSU (ORCPT ); Mon, 25 Nov 2019 20:18:20 -0500 Received: by mail-pg1-f194.google.com with SMTP id z188so8115207pgb.1 for ; Mon, 25 Nov 2019 17:18:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=IOdCZHq+8yw7YBBrvExEJd34tyBAih6z43dUJHDP6bw=; b=gCBWdgVcJ8VHvyB+zDjatBGmKw4hUa8K8ll6nnLm3MEuDqyhpiqjx1mhnZapuAm5mD 9U12R79sEsGOW8umw7CqIlSdDeXGHfRTtYKRWODFiI1JTL6p2TKl/BU7plsiCZlbFNTk WbTbjzQyw4Il/0xHPGGxPot3rK8hvlccRb4om1DFUdht9A8qrROn5TPSoWOCmiJMq6vq Lz1BMak7b/Auuqbmm2sb3x6vzjQmI0Br48pCKepC5UolxxH/ZecboRgkxKqEgxvgOg/s gegAObcrYFJ5cBrmL2Hdht0bdaj4QA0qPJBvo6h2ZqW4soIFmD8/hWvoNJSptB2Yh0zQ KqtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=IOdCZHq+8yw7YBBrvExEJd34tyBAih6z43dUJHDP6bw=; b=QLz2rvIlLyzq7T9wOs0sYGfzqH0IiJ2lhpsW7zwqZ0O4YAU+q0wtX/ZaLnG6bdb60f t7GtjFdd/l2XOoR4jSOaXib4gJKN/MEBVS+8dBi4S9s0VRXC5B5lk/G+hLjCkozT6Ffi J7be6Tg+S5PEejvV+9Mjfs4iBEwCTQw7ZMQ1LjdAr+oBuMLzwSFiwuXT9hGpcCk8Tn6k +LenEC9Eokox4ndlAv7ntBPXe0lSdnr6YWSEWYdbpbUrhmRTFPzo3LH1bMoTg3Qm8oRs Iejk0fdc5NkR75aBu0AJnWE1wAvDIxaaaRezY4lf02yuhYHZnQUxd527LKKx2lxLrbcg hB4A== X-Gm-Message-State: APjAAAXDRt/jvmduGebIGSPKgkhzUkJt1NLQzTAr2ERX943Ds+PjI7fe 07r6wOt2oc51e88qjZKxb8y+ShU1 X-Google-Smtp-Source: APXvYqz6/6w82imTrhx6TIxkRYNxKIx+5uIiYSeYCI2mOFSlQtOLGonh8EHkb/WEoHWhtZv0KjWcEQ== X-Received: by 2002:a63:774a:: with SMTP id s71mr10697909pgc.57.1574731098419; Mon, 25 Nov 2019 17:18:18 -0800 (PST) Received: from generichostname ([204.14.239.138]) by smtp.gmail.com with ESMTPSA id f10sm9683880pfd.28.2019.11.25.17.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 17:18:17 -0800 (PST) Date: Mon, 25 Nov 2019 17:18:15 -0800 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Junio C Hamano , Jeff King Subject: [PATCH v4 13/27] t5317: use ! grep to check for no matching lines Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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. While at it, drop unnecessary invocations of `awk` and `sort` in each affected test since those commands do not influence the outcome. It's not clear why that extra work was being done in the first place, and the code's history doesn't shed any light on the matter since these tests were simply born this way[1], likely due to copy-paste programming. The unnecessary work wasn't noticed even when the code was later touched for various cleanups[2][3]. [1]: 9535ce7337 (pack-objects: add list-objects filtering, 2017-11-21) [2]: bdbc17e86a (tests: standardize pipe placement, 2018-10-05) [3]: 61de0ff695 (tests: don't swallow Git errors upstream of pipes, 2018-10-05) Helped-by: Eric Sunshine 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