Skip to content

Commit 3dd8f97

Browse files
committed
sparse-checkout: improve docs around 'set' in cone mode
The existing documentation does not clarify how the 'set' subcommand changes when core.sparseCheckoutCone is enabled. Correct this by changing some language around the "A/B/C" example. Also include a description of the input format matching the output of 'git ls-tree --name-only'. Helped-by: Jeff King <[email protected]> Signed-off-by: Derrick Stolee <[email protected]>
1 parent 54be8e8 commit 3dd8f97

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Documentation/git-sparse-checkout.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ To avoid interfering with other worktrees, it first enables the
5050
+
5151
When the `--stdin` option is provided, the patterns are read from
5252
standard in as a newline-delimited list instead of from the arguments.
53+
+
54+
When `core.sparseCheckoutCone` is enabled, the input list is considered a
55+
list of directories instead of sparse-checkout patterns. The command writes
56+
patterns to the sparse-checkout file to include all files contained in those
57+
directories (recursively) as well as files that are siblings of ancestor
58+
directories. The input format matches the output of `git ls-tree --name-only`.
59+
This includes interpreting pathnames that begin with a double quote (") as
60+
C-style quoted strings.
5361

5462
'disable'::
5563
Disable the `core.sparseCheckout` config setting, and restore the
@@ -128,9 +136,12 @@ the following patterns:
128136
----------------
129137

130138
This says "include everything in root, but nothing two levels below root."
131-
If we then add the folder `A/B/C` as a recursive pattern, the folders `A` and
132-
`A/B` are added as parent patterns. The resulting sparse-checkout file is
133-
now
139+
140+
When in cone mode, the `git sparse-checkout set` subcommand takes a list of
141+
directories instead of a list of sparse-checkout patterns. In this mode,
142+
the command `git sparse-checkout set A/B/C` sets the directory `A/B/C` as
143+
a recursive pattern, the directories `A` and `A/B` are added as parent
144+
patterns. The resulting sparse-checkout file is now
134145

135146
----------------
136147
/*

0 commit comments

Comments
 (0)