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

Re: [PATCH] git-sparse-checkout: clarify interactions with submodules

From
Derrick Stolee <stolee@gmail.com>
Date
Jun 11, 2020, 11:32 UTC
Message-ID
<c135d73b-1688-7ea7-5b98-8cc6418cd4ff@gmail.com>
In-Reply-To
<pull.805.git.git.1591831009762.gitgitgadget@gmail.com>
On 6/10/2020 7:16 PM, Elijah Newren via GitGitGadget wrote:
Show 26 quoted lines
> +If your repository contains one or more submodules, then submodules
> +are populated based on interactions with the `git submodule` command.
> +Specifically, `git submodule init -- <path>` will ensure the submodule
> +at `<path>` is present, while `git submodule deinit [-f] -- <path>`
> +will remove the files for the submodule at `<path>` (including any
> +untracked files, uncommitted changes, and unpushed history).  Similar
> +to how sparse-checkout removes files from the working tree but still
> +leaves entries in the index, deinitialized submodules are removed from
> +the working directory but still have an entry in the index.
> +
> +Since submodules may have unpushed changes or untracked files,
> +removing them could result in data loss.  Thus, changing sparse
> +inclusion/exclusion rules will not cause an already checked out
> +submodule to be removed from the working copy.  Said another way, just
> +as `checkout` will not cause submodules to be automatically removed or
> +initialized even when switching between branches that remove or add
> +submodules, using `sparse-checkout` to reduce or expand the scope of
> +"interesting" files will not cause submodules to be automatically
> +deinitialized or initialized either.
> +
> +Further, the above facts mean that there are multiple reasons that
> +"tracked" files might not be present in the working copy: sparsity
> +pattern application from sparse-checkout, and submodule initialization
> +state.  Thus, commands like `git grep` that work on tracked files in
> +the working copy may return results that are limited by either or both
> +of these restrictions.
This new version looks great. I have nothing to add.
-Stolee
Previous: Elijah Newren
Message 3 of 3 in “git-sparse-checkout: clarify interactions with submodules”
  1. git-sparse-checkout: clarify interactions with submodulesElijah Newren via GitGitGadget, Jun 10, 2020
  2. Elijah NewrenJun 11, 2020
  3. Derrick StoleeJun 11, 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.