From: Elijah Newren <newren@gmail.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH 02/11] dir: add a usage note to exclude_per_dir
Date: Fri, 24 Feb 2023 19:23:02 -0800 [thread overview]
Message-ID: <CABPp-BFNd3ihQbMb+Sc270W=obnZkEgvwAuKZ8v_UBcFBoFUVg@mail.gmail.com> (raw)
In-Reply-To: <20230225015432.2065788-1-jonathantanmy@google.com>
On Fri, Feb 24, 2023 at 5:54 PM Jonathan Tan <jonathantanmy@google.com> wrote:
>
> Elijah Newren <newren@gmail.com> writes:
> > On Fri, Feb 24, 2023 at 2:31 PM Jonathan Tan <jonathantanmy@google.com> wrote:
> > >
> > > "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> > > > diff --git a/dir.h b/dir.h
> > > > index 33fd848fc8d..2196e12630c 100644
> > > > --- a/dir.h
> > > > +++ b/dir.h
> > > > @@ -295,8 +295,12 @@ struct dir_struct {
> > > > struct untracked_cache *untracked;
> > > >
> > > > /**
> > > > - * The name of the file to be read in each directory for excluded files
> > > > - * (typically `.gitignore`).
> > > > + * Deprecated: ls-files is the only allowed caller; all other callers
> > > > + * should leave this as NULL; it pre-dated the
> > > > + * setup_standard_excludes() mechanism that replaces this.
> > > > + *
> > > > + * This field tracks the name of the file to be read in each directory
> > > > + * for excluded files (typically `.gitignore`).
> > > > */
> > > > const char *exclude_per_dir;
> > >
> > > I'm not sure what is meant by "allowed caller", but I wouldn't have
> > > expected this to also mean that unpack-trees would need to know to
> > > propagate this from o->internal.dir to d in verify_clean_subdirectory.
> >
> > Are you confusing fields that are internal to dir, with fields that
> > are internal to unpack-trees?
> >
> > This series does not make exclude_per_dir an internal field within dir_struct.
>
> Agreed, but the comment says that ls-files is the only allowed caller,
> and I would have expected that non-"allowed callers" would not need to
> write to exclude_per_dir. But in unpack-trees.c:
>
> 2346 if (o->internal.dir)
> 2347 d.exclude_per_dir = o->internal.dir->exclude_per_dir;
>
> Both "d" and "o->internal.dir" are of type "struct dir_struct" (well,
> one is not a pointer and one is). I would not have expected such non-
> ls-files code to read or write from this field. (But if unpack-trees
> is considered part of ls-files and/or copying the same field to another
> struct is not considered "calling", then this patch is fine, I guess.)
Ah, gotcha, sorry for misunderstanding earlier. And you are right;
the code in unpack_trees() is buggy and should not be using
exclude_per_dir; the fact that it is using it directly actually hints
that it has bugs when exclusions are specified in .git/info/exclude
instead of .gitignore. I've found a testcase that demonstrates this;
I'll update the series with a new patch fixing it.
next prev parent reply other threads:[~2023-02-25 3:23 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 9:14 [PATCH 00/11] Clarify API for dir.[ch] and unpack-trees.[ch] -- mark relevant fields as internal Elijah Newren via GitGitGadget
2023-02-23 9:14 ` [PATCH 01/11] dir: separate public from internal portion of dir_struct Elijah Newren via GitGitGadget
2023-02-23 9:14 ` [PATCH 02/11] dir: add a usage note to exclude_per_dir Elijah Newren via GitGitGadget
2023-02-24 22:31 ` Jonathan Tan
2023-02-25 0:23 ` Elijah Newren
2023-02-25 1:54 ` Jonathan Tan
2023-02-25 3:23 ` Elijah Newren [this message]
2023-02-23 9:14 ` [PATCH 03/11] dir: mark output only fields of dir_struct as such Elijah Newren via GitGitGadget
2023-02-23 9:14 ` [PATCH 04/11] unpack-trees: clean up some flow control Elijah Newren via GitGitGadget
2023-02-24 22:33 ` Jonathan Tan
2023-02-23 9:14 ` [PATCH 05/11] sparse-checkout: avoid using internal API of unpack-trees Elijah Newren via GitGitGadget
2023-02-24 22:37 ` Jonathan Tan
2023-02-25 0:33 ` Elijah Newren
2023-02-23 9:14 ` [PATCH 06/11] sparse-checkout: avoid using internal API of unpack-trees, take 2 Elijah Newren via GitGitGadget
2023-02-24 23:22 ` Jonathan Tan
2023-02-25 0:40 ` Elijah Newren
2023-02-23 9:14 ` [PATCH 07/11] unpack_trees: start splitting internal fields from public API Elijah Newren via GitGitGadget
2023-02-23 9:14 ` [PATCH 08/11] unpack-trees: mark fields only used internally as internal Elijah Newren via GitGitGadget
2023-02-23 9:14 ` [PATCH 09/11] unpack-trees: rewrap a few overlong lines from previous patch Elijah Newren via GitGitGadget
2023-02-23 9:14 ` [PATCH 10/11] unpack-trees: special case read-tree debugging as internal usage Elijah Newren via GitGitGadget
2023-02-23 9:15 ` [PATCH 11/11] unpack-trees: add usage notices around df_conflict_entry Elijah Newren via GitGitGadget
2023-02-23 15:18 ` [PATCH 00/11] Clarify API for dir.[ch] and unpack-trees.[ch] -- mark relevant fields as internal Derrick Stolee
2023-02-23 15:26 ` Derrick Stolee
2023-02-23 20:35 ` Elijah Newren
2023-02-23 20:31 ` Elijah Newren
2023-02-24 1:24 ` Junio C Hamano
2023-02-24 5:54 ` Jacob Keller
2023-02-24 23:36 ` Jonathan Tan
2023-02-25 2:25 ` [PATCH v2 " Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 01/11] dir: separate public from internal portion of dir_struct Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 02/11] dir: add a usage note to exclude_per_dir Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 03/11] dir: mark output only fields of dir_struct as such Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 04/11] unpack-trees: clean up some flow control Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 05/11] sparse-checkout: avoid using internal API of unpack-trees Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 06/11] sparse-checkout: avoid using internal API of unpack-trees, take 2 Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 07/11] unpack_trees: start splitting internal fields from public API Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 08/11] unpack-trees: mark fields only used internally as internal Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 09/11] unpack-trees: rewrap a few overlong lines from previous patch Elijah Newren via GitGitGadget
2023-02-25 2:25 ` [PATCH v2 10/11] unpack-trees: special case read-tree debugging as internal usage Elijah Newren via GitGitGadget
2023-02-25 2:26 ` [PATCH v2 11/11] unpack-trees: add usage notices around df_conflict_entry Elijah Newren via GitGitGadget
2023-02-25 23:30 ` [PATCH v2 00/11] Clarify API for dir.[ch] and unpack-trees.[ch] -- mark relevant fields as internal Junio C Hamano
2023-02-27 15:28 ` [PATCH v3 00/13] " Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 01/13] t2021: fix platform-specific leftover cruft Elijah Newren via GitGitGadget
2023-02-27 19:11 ` Derrick Stolee
2023-02-27 15:28 ` [PATCH v3 02/13] unpack-trees: heed requests to overwrite ignored files Elijah Newren via GitGitGadget
2023-02-27 23:20 ` Jonathan Tan
2023-02-27 15:28 ` [PATCH v3 03/13] dir: separate public from internal portion of dir_struct Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 04/13] dir: add a usage note to exclude_per_dir Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 05/13] dir: mark output only fields of dir_struct as such Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 06/13] unpack-trees: clean up some flow control Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 07/13] sparse-checkout: avoid using internal API of unpack-trees Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 08/13] sparse-checkout: avoid using internal API of unpack-trees, take 2 Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 09/13] unpack_trees: start splitting internal fields from public API Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 10/13] unpack-trees: mark fields only used internally as internal Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 11/13] unpack-trees: rewrap a few overlong lines from previous patch Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 12/13] unpack-trees: special case read-tree debugging as internal usage Elijah Newren via GitGitGadget
2023-02-27 15:28 ` [PATCH v3 13/13] unpack-trees: add usage notices around df_conflict_entry Elijah Newren via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABPp-BFNd3ihQbMb+Sc270W=obnZkEgvwAuKZ8v_UBcFBoFUVg@mail.gmail.com' \
--to=newren@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=jonathantanmy@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).