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: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 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_LOW, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id AB7D71F8C6 for ; Thu, 19 Aug 2021 20:54:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234904AbhHSUyl (ORCPT ); Thu, 19 Aug 2021 16:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbhHSUyj (ORCPT ); Thu, 19 Aug 2021 16:54:39 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D691C061575 for ; Thu, 19 Aug 2021 13:54:03 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id 61-20020a9d0d430000b02903eabfc221a9so10415147oti.0 for ; Thu, 19 Aug 2021 13:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tVbugsjrPmcjbsNTOTEfp5lFZitoj2IcSfrm20Ju0nc=; b=I15xaoABJ3VK9/TMgyWimwprdmGm8yhAE8+70gRT0l4EkGrmM+KqKUqkg0QpHxF5CN +IgHT/ktkpMfa41cilErMTa8e/HbIpGiyhKyWTiERpfPOVY8GIdde+k+n3bsJs+mvBP/ Ijt8cQb9sMv2yZOvobzfiSfCft3RreC5fikAoiBVCqvgr2z2r4gAn5FiBvvnxRXpEQWM swtUzOlEF/9t4alZ605eTklB7VQzdmybAkjJVrQr9/iCgQbFPLbJa0BWkADYVX7LUWDS amtRVDgnRvN8gAuDDK5Glyotd8ES8+NWH6XpTH0MAUTXNBK9Ro58e4zpZPsz5AYN7gyZ WAjw== 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=tVbugsjrPmcjbsNTOTEfp5lFZitoj2IcSfrm20Ju0nc=; b=t9EHvsdarZbjqdKAWVr/FUcDd92L6uESyf5ryGX3xePKonbxeI2s+wOsuF5f2RW5g5 xjYGHWJKSaDUz/G5hHxsxSLd5yzSXklFNHOTgKhZ0eGOTaua5GZHWelaFyOsr0L7Ry7n /kAcPjz3aNwjOVRaSVjzBzFsYWIXLoKoBznTvTgFpd8Qm4r3coxulJVkvIThzdv98XZx /Kn9jKGochW2x12CzXgidbU8zB1iXg3qM1EotfQ/z38od7nk1eBT4gnoSPsFAokb5sla Bod3sUscmK/DffgulJL5dnfujPcd36G3k4TfIaQ6mnA04l7BO5D6uqsJSr1At9l/Ayjc wOCQ== X-Gm-Message-State: AOAM5334TNUUPpxyDugiJJP/T/FKUL09A9gQBfU4sVpHktOG5poH4oSw GH/R8AoUei+0HyzJuUmeQF9dEmHw16b3leBRStY= X-Google-Smtp-Source: ABdhPJxsaBwD+9Y0nQcrkgoRw2xxizuWY5wlQucEi89C2WEc+MVgH/Yvmv4PxkKfd365BBV5tIV3vwdHtPXEX7hSqNA= X-Received: by 2002:a05:6830:1da:: with SMTP id r26mr13367384ota.162.1629406442248; Thu, 19 Aug 2021 13:54:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Elijah Newren Date: Thu, 19 Aug 2021 13:53:51 -0700 Message-ID: Subject: Re: [PATCH v3 6/8] attr: be careful about sparse directories To: Derrick Stolee via GitGitGadget Cc: Git Mailing List , Junio C Hamano , Matheus Tavares Bernardino , Derrick Stolee , Derrick Stolee , Derrick Stolee Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, Aug 17, 2021 at 6:23 AM Derrick Stolee via GitGitGadget wrote: > > From: Derrick Stolee > > Signed-off-by: Derrick Stolee > --- > attr.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/attr.c b/attr.c > index d029e681f28..a1009f78029 100644 > --- a/attr.c > +++ b/attr.c > @@ -14,6 +14,7 @@ > #include "utf8.h" > #include "quote.h" > #include "thread-utils.h" > +#include "dir.h" > > const char git_attr__true[] = "(builtin)true"; > const char git_attr__false[] = "\0(builtin)false"; > @@ -744,6 +745,19 @@ static struct attr_stack *read_attr_from_index(struct index_state *istate, > if (!istate) > return NULL; > > + /* > + * In the case of cone-mode sparse-checkout, getting the > + * .gitattributes file from a directory is meaningless: all > + * contained paths will be sparse if the .gitattributes is also > + * sparse. In the case of a sparse index, it is critical that we > + * don't go looking for one as it will expand the index. > + */ "all contained paths will be sparse if the .gitattributes is also sparse"? Do you mean something more like "the .gitattributes only applies for files under the given directory, and if the directory is sparse, then neither the .gitattributes file or any other file under that directory will be present" ? Also, out of curiosity, I was suggesting in the past we do something like this for .gitignore files, for the same reason. Do we have such logic in place, or is that another area of the code that hasn't been handled yet? > + init_sparse_checkout_patterns(istate); > + if (istate->sparse_checkout_patterns && > + istate->sparse_checkout_patterns->use_cone_patterns && > + path_in_sparse_checkout(path, istate) == NOT_MATCHED) > + return NULL; > + > buf = read_blob_data_from_index(istate, path, NULL); > if (!buf) > return NULL; > -- > gitgitgadget Though the code appears correct, I too am curious about the questions Dscho asked about the code in this patch.