From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, 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 2D3621F463 for ; Tue, 26 Nov 2019 02:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727465AbfKZCfq (ORCPT ); Mon, 25 Nov 2019 21:35:46 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43450 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727454AbfKZCfq (ORCPT ); Mon, 25 Nov 2019 21:35:46 -0500 Received: by mail-wr1-f67.google.com with SMTP id n1so20575181wra.10 for ; Mon, 25 Nov 2019 18:35:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5Vk+qdowha4Hv6+eyaQnQuwiGoCz3jAD0YMOKR5BDYo=; b=awPTAYgzUuRdBOj+YqwzrhPCSlfKglB6fv7h6JZ2JdGLneu2r09H0Ursi4flMmN98D 3E5gAY7XuKO4NQnYBmVoFsUwQnreKA2TotfsV+FyuXj3rze2RQx3jTqB2YmYERtGRX8a fScbTxvCqovISjhSzzHBjQWCdXP7iGPCn+6IF6poMeFXyIlTxeu6EZTqdYURVEOX1GSE LMNJRyHyKDWRvmpFQ7behckLvYx9UxG0ncBsIcc3jeAk1y+aIvr82I5ukwUNnUFUa/8f PWU+sawW8ZwiINc56wo9q/666UOX6z8JENJYQ51zLLlPIanYS7eyY2hNSokqMhtuDZdq SNQQ== X-Gm-Message-State: APjAAAXeuNG099nHc7HHjrPflFmLc7unzZ8YuWO6mq7IAUbBKiE6JPXm hynACvSkABnehNrhqPn6Mt2FY5gf5SwOgsP67m8= X-Google-Smtp-Source: APXvYqxxnRiGEn8nz3dwgjQdF7x3co9aI0EfegFhjSnLASdbSU6CrUb821MXYD9iyVGlqEAIJT2To2/GTssWDVliUQ4= X-Received: by 2002:adf:b193:: with SMTP id q19mr33615687wra.78.1574735744828; Mon, 25 Nov 2019 18:35:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Eric Sunshine Date: Mon, 25 Nov 2019 21:35:33 -0500 Message-ID: Subject: Re: [PATCH v4 22/27] t7700: consolidate code into test_no_missing_in_packs() To: Denton Liu Cc: Git Mailing List , Junio C Hamano , Jeff King Content-Type: text/plain; charset="UTF-8" Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Nov 25, 2019 at 8:21 PM Denton Liu wrote: > The code to test that objects were not missing from the packfile was > duplicated many times. Extract the duplicated code into > test_no_missing_in_packs() and use that instead. > > Refactor the resulting extraction so that if any git commands fail, > their return codes are not silently lost. > > We were using sed to filter lines. Although not incorrect, this is > exactly what grep is built for. Replace this invocation of sed with grep > so that we use the correct tool for the job. > > The original testing construct was O(n^2): it used a grep in a loop to > test whether any objects were missing in the packfile. Rewrite this to > use sort the files then use `comm -23` so that finding missing lines s/use sort/sort/ > from the original file is done more efficiently. > > While we're at it, add a space to `commit_and_pack ()` for style. > > Signed-off-by: Denton Liu