git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Derrick Stolee <stolee@gmail.com>,
	Lessley Dennington <lessleydennington@gmail.com>,
	Victoria Dye <vdye@github.com>, Elijah Newren <newren@gmail.com>,
	Elijah Newren <newren@gmail.com>,
	Elijah Newren <newren@gmail.com>
Subject: [PATCH v2 08/10] git-sparse-checkout.txt: update to document init/set/reapply changes
Date: Tue, 07 Dec 2021 20:20:08 +0000	[thread overview]
Message-ID: <17b033caf4bc8c044795f5cb6580adaef15a9725.1638908410.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1151.v2.git.git.1638908410.gitgitgadget@gmail.com>

From: Elijah Newren <newren@gmail.com>

As noted in the previous commit, using separate `init` and `set` steps
with sparse-checkout result in a number of issues.  The previous commits
made `set` able to handle the work of both commands, and enabled reapply
to tweak the {cone,sparse-index} settings.  Update the documentation to
reflect this, and mark `init` as deprecated.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 Documentation/git-sparse-checkout.txt | 98 +++++++++++++++------------
 1 file changed, 55 insertions(+), 43 deletions(-)

diff --git a/Documentation/git-sparse-checkout.txt b/Documentation/git-sparse-checkout.txt
index 42056ee9ff9..c7a25e282e7 100644
--- a/Documentation/git-sparse-checkout.txt
+++ b/Documentation/git-sparse-checkout.txt
@@ -30,28 +30,36 @@ COMMANDS
 'list'::
 	Describe the patterns in the sparse-checkout file.
 
-'init'::
-	Enable the `core.sparseCheckout` setting. If the
-	sparse-checkout file does not exist, then populate it with
-	patterns that match every file in the root directory and
-	no other directories, then will remove all directories tracked
-	by Git. Add patterns to the sparse-checkout file to
-	repopulate the working directory.
+'set'::
+	Enable the necessary config settings
+	(extensions.worktreeConfig, core.sparseCheckout,
+	core.sparseCheckoutCone) if they are not already enabled, and
+	write a set of patterns to the sparse-checkout file from the
+	list of arguments following the 'set' subcommand. Update the
+	working directory to match the new patterns.
 +
-To avoid interfering with other worktrees, it first enables the
-`extensions.worktreeConfig` setting and makes sure to set the
-`core.sparseCheckout` setting in the worktree-specific config file.
+When the `--stdin` option is provided, the patterns are read from
+standard in as a newline-delimited list instead of from the arguments.
 +
-When `--cone` is provided, the `core.sparseCheckoutCone` setting is
-also set, allowing for better performance with a limited set of
-patterns (see 'CONE PATTERN SET' below).
+When `--cone` is passed or `core.sparseCheckoutCone` is enabled, the
+input list is considered a list of directories instead of
+sparse-checkout patterns.  This allows for better performance with a
+limited set of patterns (see 'CONE PATTERN SET' below).  Note that the
+set command will write patterns to the sparse-checkout file to include
+all files contained in those directories (recursively) as well as
+files that are siblings of ancestor directories. The input format
+matches the output of `git ls-tree --name-only`.  This includes
+interpreting pathnames that begin with a double quote (") as C-style
+quoted strings.  This may become the default in the future; --no-cone
+can be passed to request non-cone mode.
 +
-Use the `--[no-]sparse-index` option to toggle the use of the sparse
-index format. This reduces the size of the index to be more closely
-aligned with your sparse-checkout definition. This can have significant
-performance advantages for commands such as `git status` or `git add`.
-This feature is still experimental. Some commands might be slower with
-a sparse index until they are properly integrated with the feature.
+Use the `--[no-]sparse-index` option to use a sparse index (the
+default is to not use it).  A sparse index reduces the size of the
+index to be more closely aligned with your sparse-checkout
+definition. This can have significant performance advantages for
+commands such as `git status` or `git add`.  This feature is still
+experimental. Some commands might be slower with a sparse index until
+they are properly integrated with the feature.
 +
 **WARNING:** Using a sparse index requires modifying the index in a way
 that is not completely understood by external tools. If you have trouble
@@ -60,23 +68,6 @@ to rewrite your index to not be sparse. Older versions of Git will not
 understand the sparse directory entries index extension and may fail to
 interact with your repository until it is disabled.
 
-'set'::
-	Write a set of patterns to the sparse-checkout file, as given as
-	a list of arguments following the 'set' subcommand. Update the
-	working directory to match the new patterns. Enable the
-	core.sparseCheckout config setting if it is not already enabled.
-+
-When the `--stdin` option is provided, the patterns are read from
-standard in as a newline-delimited list instead of from the arguments.
-+
-When `core.sparseCheckoutCone` is enabled, the input list is considered a
-list of directories instead of sparse-checkout patterns. The command writes
-patterns to the sparse-checkout file to include all files contained in those
-directories (recursively) as well as files that are siblings of ancestor
-directories. The input format matches the output of `git ls-tree --name-only`.
-This includes interpreting pathnames that begin with a double quote (") as
-C-style quoted strings.
-
 'add'::
 	Update the sparse-checkout file to include additional patterns.
 	By default, these patterns are read from the command-line arguments,
@@ -93,12 +84,35 @@ C-style quoted strings.
 	cases, it can make sense to run `git sparse-checkout reapply` later
 	after cleaning up affected paths (e.g. resolving conflicts, undoing
 	or committing changes, etc.).
++
+The `reapply` command can also take `--[no-]cone` and `--[no-]sparse-index`
+flags, with the same meaning as the flags from the `set` command, in order
+to change which sparsity mode you are using without needing to also respecify
+all sparsity paths.
 
 'disable'::
 	Disable the `core.sparseCheckout` config setting, and restore the
-	working directory to include all files. Leaves the sparse-checkout
-	file intact so a later 'git sparse-checkout init' command may
-	return the working directory to the same state.
+	working directory to include all files.
+
+'init'::
+	Deprecated command that behaves like `set` with no specified paths.
+	May be removed in the future.
++
+Historically, `set` did not used to handle all the necessary config
+settings, which meant that both `init` and `set` had to be called.
+Invoking both meant the `init` step would first remove nearly all
+tracked files (and in cone mode, ignored files too), then the `set`
+step would add many of the tracked files (but not ignored files) back.
+In addition to the lost files, the performance and UI of this
+combination was poor.
++
+Also, historically, `init` would not actually initialize the
+sparse-checkout file if it already existed.  This meant it was
+possible to return to a sparse-checkout without remembering which
+paths to pass to a subsequent 'set' or 'add' command.  However,
+`--cone` and `--sparse-index` options would not be remembered across
+the disable command, so the easy restore of calling a plain `init`
+decreased in utility.
 
 SPARSE CHECKOUT
 ---------------
@@ -117,10 +131,8 @@ directory, it updates the skip-worktree bits in the index based
 on this file. The files matching the patterns in the file will
 appear in the working directory, and the rest will not.
 
-To enable the sparse-checkout feature, run `git sparse-checkout init` to
-initialize a simple sparse-checkout file and enable the `core.sparseCheckout`
-config setting. Then, run `git sparse-checkout set` to modify the patterns in
-the sparse-checkout file.
+To enable the sparse-checkout feature, run `git sparse-checkout set` to
+set the patterns you want to use.
 
 To repopulate the working directory with all files, use the
 `git sparse-checkout disable` command.
-- 
gitgitgadget


  parent reply	other threads:[~2021-12-07 20:20 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 20:00 [PATCH 0/6] sparse-checkout: make set subsume init Elijah Newren via GitGitGadget
2021-12-04 20:00 ` [PATCH 1/6] sparse-checkout: pass use_stdin as a parameter instead of as a global Elijah Newren via GitGitGadget
2021-12-04 20:00 ` [PATCH 2/6] sparse-checkout: break apart functions for sparse_checkout_(set|add) Elijah Newren via GitGitGadget
2021-12-04 20:00 ` [PATCH 3/6] sparse-checkout: enable `set` to initialize sparse-checkout mode Elijah Newren via GitGitGadget
2021-12-04 21:40   ` Victoria Dye
2021-12-07 17:04     ` Elijah Newren
2021-12-07 20:36       ` Lessley Dennington
2021-12-07 16:42   ` Derrick Stolee
2021-12-07 18:18     ` Elijah Newren
2021-12-04 20:00 ` [PATCH 4/6] git-sparse-checkout.txt: update to document that set handles init Elijah Newren via GitGitGadget
2021-12-04 21:48   ` Victoria Dye
2021-12-07 16:45     ` Derrick Stolee
2021-12-07 17:06     ` Elijah Newren
2021-12-07 20:42   ` Lessley Dennington
2021-12-07 21:13     ` Elijah Newren
2021-12-07 22:36       ` Lessley Dennington
2021-12-04 20:00 ` [PATCH 5/6] Documentation: clarify/correct a few sparsity related statements Elijah Newren via GitGitGadget
2021-12-04 20:00 ` [PATCH 6/6] clone: avoid using deprecated `sparse-checkout init` Elijah Newren via GitGitGadget
2021-12-07 16:48 ` [PATCH 0/6] sparse-checkout: make set subsume init Derrick Stolee
2021-12-07 20:20 ` [PATCH v2 00/10] " Elijah Newren via GitGitGadget
2021-12-07 20:20   ` [PATCH v2 01/10] sparse-checkout: pass use_stdin as a parameter instead of as a global Elijah Newren via GitGitGadget
2021-12-07 20:20   ` [PATCH v2 02/10] sparse-checkout: break apart functions for sparse_checkout_(set|add) Elijah Newren via GitGitGadget
2021-12-07 20:20   ` [PATCH v2 03/10] sparse-checkout: add sanity-checks on initial sparsity state Elijah Newren via GitGitGadget
2021-12-07 20:20   ` [PATCH v2 04/10] sparse-checkout: disallow --no-stdin as an argument to set Elijah Newren via GitGitGadget
2021-12-07 20:20   ` [PATCH v2 05/10] sparse-checkout: split out code for tweaking settings config Elijah Newren via GitGitGadget
2021-12-07 20:20   ` [PATCH v2 06/10] sparse-checkout: enable `set` to initialize sparse-checkout mode Elijah Newren via GitGitGadget
2021-12-07 20:20   ` [PATCH v2 07/10] sparse-checkout: enable reapply to take --[no-]{cone,sparse-index} Elijah Newren via GitGitGadget
2021-12-07 20:20   ` Elijah Newren via GitGitGadget [this message]
2021-12-07 20:20   ` [PATCH v2 09/10] Documentation: clarify/correct a few sparsity related statements Elijah Newren via GitGitGadget
2021-12-07 20:20   ` [PATCH v2 10/10] clone: avoid using deprecated `sparse-checkout init` Elijah Newren via GitGitGadget
2021-12-07 21:05   ` [PATCH v2 00/10] sparse-checkout: make set subsume init Derrick Stolee
2021-12-08 14:16   ` Victoria Dye
2021-12-10  3:56   ` [PATCH v3 " Elijah Newren via GitGitGadget
2021-12-10  3:56     ` [PATCH v3 01/10] sparse-checkout: pass use_stdin as a parameter instead of as a global Elijah Newren via GitGitGadget
2021-12-10  3:56     ` [PATCH v3 02/10] sparse-checkout: break apart functions for sparse_checkout_(set|add) Elijah Newren via GitGitGadget
2021-12-10  3:56     ` [PATCH v3 03/10] sparse-checkout: add sanity-checks on initial sparsity state Elijah Newren via GitGitGadget
2021-12-13 18:11       ` Junio C Hamano
2021-12-14  2:25         ` Elijah Newren
2021-12-10  3:56     ` [PATCH v3 04/10] sparse-checkout: disallow --no-stdin as an argument to set Elijah Newren via GitGitGadget
2021-12-10  3:56     ` [PATCH v3 05/10] sparse-checkout: split out code for tweaking settings config Elijah Newren via GitGitGadget
2021-12-10  3:56     ` [PATCH v3 06/10] sparse-checkout: enable `set` to initialize sparse-checkout mode Elijah Newren via GitGitGadget
2021-12-10  3:56     ` [PATCH v3 07/10] sparse-checkout: enable reapply to take --[no-]{cone,sparse-index} Elijah Newren via GitGitGadget
2021-12-13 18:23       ` Junio C Hamano
2021-12-14  2:39         ` Elijah Newren
2021-12-10  3:56     ` [PATCH v3 08/10] git-sparse-checkout.txt: update to document init/set/reapply changes Elijah Newren via GitGitGadget
2021-12-10  3:56     ` [PATCH v3 09/10] Documentation: clarify/correct a few sparsity related statements Elijah Newren via GitGitGadget
2021-12-10  3:56     ` [PATCH v3 10/10] clone: avoid using deprecated `sparse-checkout init` Elijah Newren via GitGitGadget
2021-12-14  4:09     ` [PATCH v4 00/10] sparse-checkout: make set subsume init Elijah Newren via GitGitGadget
2021-12-14  4:09       ` [PATCH v4 01/10] sparse-checkout: pass use_stdin as a parameter instead of as a global Elijah Newren via GitGitGadget
2021-12-14  4:09       ` [PATCH v4 02/10] sparse-checkout: break apart functions for sparse_checkout_(set|add) Elijah Newren via GitGitGadget
2021-12-14  4:09       ` [PATCH v4 03/10] sparse-checkout: add sanity-checks on initial sparsity state Elijah Newren via GitGitGadget
2021-12-14  4:09       ` [PATCH v4 04/10] sparse-checkout: disallow --no-stdin as an argument to set Elijah Newren via GitGitGadget
2021-12-14  4:09       ` [PATCH v4 05/10] sparse-checkout: split out code for tweaking settings config Elijah Newren via GitGitGadget
2021-12-14  4:09       ` [PATCH v4 06/10] sparse-checkout: enable `set` to initialize sparse-checkout mode Elijah Newren via GitGitGadget
2021-12-14  4:09       ` [PATCH v4 07/10] sparse-checkout: enable reapply to take --[no-]{cone,sparse-index} Elijah Newren via GitGitGadget
2021-12-23  0:47         ` Jiang Xin
2021-12-23 17:09           ` Elijah Newren
2021-12-23 19:09             ` Junio C Hamano
2021-12-14  4:09       ` [PATCH v4 08/10] git-sparse-checkout.txt: update to document init/set/reapply changes Elijah Newren via GitGitGadget
2021-12-14  4:09       ` [PATCH v4 09/10] Documentation: clarify/correct a few sparsity related statements Elijah Newren via GitGitGadget
2021-12-14  7:38         ` Bagas Sanjaya
2021-12-14  7:48           ` Elijah Newren
2021-12-14  4:09       ` [PATCH v4 10/10] clone: avoid using deprecated `sparse-checkout init` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17b033caf4bc8c044795f5cb6580adaef15a9725.1638908410.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=lessleydennington@gmail.com \
    --cc=newren@gmail.com \
    --cc=stolee@gmail.com \
    --cc=vdye@github.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.
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 NNTP newsgroup(s).