git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] unpack-trees: do not set SKIP_WORKTREE on submodules

From
Elijah Newren <newren@gmail.com>
Date
Jun 18, 2020, 19:19 UTC
Message-ID
<CABPp-BHV6iKH4PS6Gqfhe6piBdgmZ9D+cgXvSJ+dNcw-UHD-+w@mail.gmail.com>
In-Reply-To
<CAHd-oW7tT7GhHz7mCH9Y66B=kriBKv8ZyrTXT-VTJgcXGa1Jzw@mail.gmail.com>

On Thu, Jun 18, 2020 at 7:34 AM Matheus Tavares Bernardino <matheus.bernardino@usp.br> wrote:

Show 38 quoted lines
>
> On Wed, Jun 17, 2020 at 9:24 PM Elijah Newren <newren@gmail.com> wrote:
> >
> > If someone were
> > to try do change their sparsity patterns or even just run a "git
> > sparse-checkout reapply" when they had the above issues, they'd see
> > something like:
> >
> >     $ git sparse-checkout reapply
> >     warning: The following paths are unmerged and were left despite
> > sparse patterns:
> >             filename_with_conflicts
> >
> >     After fixing the above paths, you may want to run `git
> > sparse-checkout reapply`.
> >
> > This basically suggests that we consider uncommitted and unmerged
> > files to be "unclean" in some way (sparse-checkout wants to set the
> > SKIP_WORKTREE bit on all files that do not match the sparsity
> > specification, so "clean" means sparse-checkout is able to do so).  So
> > I could amend my earlier comparison and say that IF the user has a
> > clean directory, then "git grep --recurse-submodules $REVISION
> > $PATTERN" should be equivalent to "git checkout $REVISION && git grep
> > --recurse-submodules $PATTERN".  I could also say that given the big
> > warnings we give users when we can't set the SKIP_WORKTREE bit, that
> > we expect it to be a transient state and thus that we expect them to
> > more likely than not clear it out by the time they do switch branches.
> > That would lead us to the follow-up rule that if the user does not
> > have a clean directory then "git grep --recurse-submodules $REVISION
> > $PATTERN" should be equivalent to what you would get if the unclean
> > entries were ignored (expecting them to be cleaned before the any `git
> > checkout` could be run) and you then otherwise ran "git checkout
> > $REVISION && git grep --recurse-submodules $PATTERN".
>
> Makes sense, thanks! We haven't mentioned "git grep --cached" yet, but
> it would behave in the same way of the worktree grep, in this case.
> (I.e. searching the submodules, as their SKIP_WORTREE bit was not
> set.) So I guess it should be fine, as well.
:-)
Show 14 quoted lines
> > That suggests that grep's implementation we agreed on earlier is still
> > correct (when given a $REVISION ignore submodulees that do not match
> > the sparsity patterns), but that unpack-trees/sparse-checkout still
> > need an update:
> >
> > When we notice an initialized submodule that does not match the
> > sparsity patterns, we should print a warning just like we do for
> > unmerged and dirty entries.
>
> Yeah, seems like a good approach. Thanks for the explanations. Some of
> the test cases in mt/grep-sparse-checkout will have to be adjusted
> with this change. Should I reroll the series based on the patch you
> will send or do you prefer to adjust them in your patch (and make it
> dependent on mt/grep-sparse-checkout)?

Ah, good catch. Your series came first, is longer, and is reviewed other than the submodule/config stuff that needs someone more familiar with that area than me. Since my patch needs more work anyway, how about I rebase my patch on top of your work, and make sure to ping you as a reviewer to make sure I don't mess anything up?

Thanks, Elijah

Previous: Matheus Tavares BernardinoNext: Matheus Tavares Bernardino
Message 5 of 6 in “unpack-trees: do not set SKIP_WORKTREE on submodules”
  1. unpack-trees: do not set SKIP_WORKTREE on submodulesElijah Newren via GitGitGadget, Jun 17, 2020
  2. Matheus Tavares BernardinoJun 17, 2020
  3. Elijah NewrenJun 18, 2020
  4. Matheus Tavares BernardinoJun 18, 2020
  5. Elijah NewrenJun 18, 2020
  6. Matheus Tavares BernardinoJun 18, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.