From patchwork Wed Aug 5 23:06:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Tan X-Patchwork-Id: 11702593 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 45005722 for ; Wed, 5 Aug 2020 23:07:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2749C22CAE for ; Wed, 5 Aug 2020 23:07:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HwMM+864" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726511AbgHEXHA (ORCPT ); Wed, 5 Aug 2020 19:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbgHEXG6 (ORCPT ); Wed, 5 Aug 2020 19:06:58 -0400 Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 000A4C061574 for ; Wed, 5 Aug 2020 16:06:57 -0700 (PDT) Received: by mail-qk1-x74a.google.com with SMTP id h185so32064253qke.21 for ; Wed, 05 Aug 2020 16:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=scTkRdah1xxojQ5Q/+8y7jE8EgvmIKzdAOxLD0CEXi4=; b=HwMM+864J0IJeJfM1TkrNwJkuDrTPP3zbj26Pimsk64nAGKzX2nTip8qWBg1W5EZQS elSNXzmKu6NMXH9p1mIuXakQoSafVboGTZyyRwOO7bLIHf2BBJCf2imZp3EvUQODJNvp Aht862gvD3eo8hcGxaaf4W+p3prAAFQxUNwWrjmrYVgPQ3WSNKs91dh3iq7lqQoWuB8s wt2uVmOkxHbhIBpYhvSA6w1ZVv7X/SidwhGs9qnmFOXhWyPiP5Bz8RQbt6nzLcCOHrEF TvcibVAfftFRgay7O2caYWEnmvMzjSh3oLoqKjdwhnf4ch492qORaWWBh6k+ieGQNfC+ eNUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=scTkRdah1xxojQ5Q/+8y7jE8EgvmIKzdAOxLD0CEXi4=; b=pywb5aBUHsuHtFpMmDpcrI5TWX1J7XBW8Lv655u1Wgpltg0ZCkorEVULPlbMoG1GTn +G3fsq/THHkyWnPpvUnRGcWhyN+TFQ+gR9Q2ciMSVktcNrIJ5uIq2dhAdb35YzXU9Wks UcMrcLpw6o0JEDgE6Jhtu9rZyFZDwPFn9+QcjCcDL6VVihXJdc3Dj2nC5mwmUmLHrCtf 1inh4ZaEJkMl9OVhM42bxHtDYoIxPKbpUSh04TqgsjvFeFyDqCz75xBOlB73Xcow/nP1 lLcryUJJVBRSBqHUvARelAdVznWzoRDQnlCwuyB0DC3juYFAPmF/NKyDrz2cySYWgipc Dt4A== X-Gm-Message-State: AOAM533AWsO6uxYFE3u2qOr6oLYC8Ls++/gGl+3MzAnePtFaF9HpxtQz 4Pf32ajcBkFROuE1dOMPche6BIh0659KPUWn7m0tHnCzPMyk6aLuxBexGmRqSa48CxOLHrVU/Lw FoaQpxbyQyD99ee1SZp30FcjUHsDhx0A04de21YXJ8q6mKU3EWfat6bn6HyrN8TJrFgJXXW2FeB nW X-Google-Smtp-Source: ABdhPJwAva9JvWWiF27K4KEc9MQZCa1uJ/InuhqUpTXSvOcORN5QBbH3RwS4w4Ot2cUIrG/IlPdg+sI6OBe0f8vdgYes X-Received: by 2002:a0c:cc94:: with SMTP id f20mr6242070qvl.159.1596668817006; Wed, 05 Aug 2020 16:06:57 -0700 (PDT) Date: Wed, 5 Aug 2020 16:06:48 -0700 In-Reply-To: <20200728010403.95142-1-jonathantanmy@google.com> Message-Id: Mime-Version: 1.0 References: <20200728010403.95142-1-jonathantanmy@google.com> X-Mailer: git-send-email 2.28.0.236.gb10cc79966-goog Subject: [PATCH v2 0/4] No-lazy-fetch has_object() and some fixes From: Jonathan Tan To: git@vger.kernel.org Cc: Jonathan Tan , gitster@pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since v1, I've took a look at 3 other cases that use has_object_file(): 2 don't need lazy-fetching (patches 3 and 4 in this set) and 1 does - "cat-file -e" - although I think this is a special case. So I still think that not lazy-fetching when checking object existence is more likely, and should be privileged with the shorter function name (has_object() instead of has_object_locally()). Changes from v1: - Patch split into 2 (patch 1 and patch 2) - 2 additional patches that fix bugs by making use of the new function Jonathan Tan (4): sha1-file: introduce no-lazy-fetch has_object() apply: do not lazy fetch when applying binary pack-objects: no fetch when allow-{any,promisor} fsck: do not lazy fetch known non-promisor object Documentation/git-pack-objects.txt | 11 +++++++---- apply.c | 2 +- builtin/fsck.c | 2 +- builtin/pack-objects.c | 4 ++-- object-store.h | 25 +++++++++++++++++++++++-- sha1-file.c | 12 ++++++++++++ t/t4150-am.sh | 16 ++++++++++++++++ 7 files changed, 62 insertions(+), 10 deletions(-)