path: root/Documentation/git-sparse-checkout.txt
diff options
Diffstat (limited to 'Documentation/git-sparse-checkout.txt')
1 files changed, 54 insertions, 1 deletions
diff --git a/Documentation/git-sparse-checkout.txt b/Documentation/git-sparse-checkout.txt
index c2cb19f..8535f0c 100644
--- a/Documentation/git-sparse-checkout.txt
+++ b/Documentation/git-sparse-checkout.txt
@@ -80,7 +80,9 @@ the sparse-checkout file.
To repopulate the working directory with all files, use the
`git sparse-checkout disable` command.
By default, the sparse-checkout file uses the same syntax as `.gitignore`
@@ -95,6 +97,57 @@ using negative patterns. For example, to remove the file `unwanted`:
+The full pattern set allows for arbitrary pattern matches and complicated
+inclusion/exclusion rules. These can result in O(N*M) pattern matches when
+updating the index, where N is the number of patterns and M is the number
+of paths in the index. To combat this performance issue, a more restricted
+pattern set is allowed when `core.spareCheckoutCone` is enabled.
+The accepted patterns in the cone pattern set are:
+1. *Recursive:* All paths inside a directory are included.
+2. *Parent:* All files immediately inside a directory are included.
+In addition to the above two patterns, we also expect that all files in the
+root directory are included. If a recursive pattern is added, then all
+leading directories are added as parent patterns.
+By default, when running `git sparse-checkout init`, the root directory is
+added as a parent pattern. At this point, the sparse-checkout file contains
+the following patterns:
+This says "include everything in root, but nothing two levels below root."
+If we then add the folder `A/B/C` as a recursive pattern, the folders `A` and
+`A/B` are added as parent patterns. The resulting sparse-checkout file is
+Here, order matters, so the negative patterns are overridden by the positive
+patterns that appear lower in the file.
+If `core.sparseCheckoutCone=true`, then Git will parse the sparse-checkout file
+expecting patterns of these types. Git will warn if the patterns do not match.
+If the patterns do match the expected format, then Git will use faster hash-
+based algorithms to compute inclusion in the sparse-checkout.