-
Notifications
You must be signed in to change notification settings - Fork 143
New sparse-checkout builtin and "cone" mode #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
81a1526
fcfe477
7ef5f2e
248fc17
7517982
6431141
0bc87c1
3b9e11d
eca0bbf
951e622
745910b
3d0f951
2703b34
63e01c2
cc6773e
a0dca00
4097d8f
c62d975
7577ffc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,7 @@ | |
/git-show-branch | ||
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Elijah Newren wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Elijah Newren wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
|
||
/git-show-index | ||
/git-show-ref | ||
/git-sparse-checkout | ||
/git-stage | ||
/git-stash | ||
/git-status | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -593,8 +593,14 @@ core.multiPackIndex:: | |
multi-pack-index design document]. | ||
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
|
||
|
||
core.sparseCheckout:: | ||
Enable "sparse checkout" feature. See section "Sparse checkout" in | ||
linkgit:git-read-tree[1] for more information. | ||
Enable "sparse checkout" feature. See linkgit:git-sparse-checkout[1] | ||
for more information. | ||
|
||
core.sparseCheckoutCone:: | ||
Enables the "cone mode" of the sparse checkout feature. When the | ||
sparse-checkout file contains a limited set of patterns, then this | ||
mode provides significant performance advantages. See | ||
linkgit:git-sparse-checkout[1] for more information. | ||
|
||
core.abbrev:: | ||
Set the length object names are abbreviated to. If | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ SYNOPSIS | |
[--dissociate] [--separate-git-dir <git dir>] | ||
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Elijah Newren wrote (reply to this):
|
||
[--depth <depth>] [--[no-]single-branch] [--no-tags] | ||
[--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules] | ||
[--[no-]remote-submodules] [--jobs <n>] [--] <repository> | ||
[--[no-]remote-submodules] [--jobs <n>] [--sparse] [--] <repository> | ||
[<directory>] | ||
|
||
DESCRIPTION | ||
|
@@ -156,6 +156,12 @@ objects from the source repository into a pack in the cloned repository. | |
used, neither remote-tracking branches nor the related | ||
configuration variables are created. | ||
|
||
--sparse:: | ||
Initialize the sparse-checkout file so the working | ||
directory starts with only the files in the root | ||
of the repository. The sparse-checkout file can be | ||
modified to grow the working directory as needed. | ||
|
||
--mirror:: | ||
Set up a mirror of the source repository. This implies `--bare`. | ||
Compared to `--bare`, `--mirror` not only maps local branches of the | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
git-sparse-checkout(1) | ||
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Elijah Newren wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Elijah Newren wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Elijah Newren wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, SZEDER Gábor wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Elijah Newren wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Derrick Stolee wrote (reply to this):
|
||
====================== | ||
|
||
NAME | ||
---- | ||
git-sparse-checkout - Initialize and modify the sparse-checkout | ||
configuration, which reduces the checkout to a set of paths | ||
given by a list of atterns. | ||
|
||
|
||
SYNOPSIS | ||
-------- | ||
[verse] | ||
'git sparse-checkout <subcommand> [options]' | ||
|
||
|
||
DESCRIPTION | ||
----------- | ||
|
||
Initialize and modify the sparse-checkout configuration, which reduces | ||
the checkout to a set of paths given by a list of patterns. | ||
|
||
THIS COMMAND IS EXPERIMENTAL. ITS BEHAVIOR, AND THE BEHAVIOR OF OTHER | ||
COMMANDS IN THE PRESENCE OF SPARSE-CHECKOUTS, WILL LIKELY CHANGE IN | ||
THE FUTURE. | ||
|
||
|
||
COMMANDS | ||
-------- | ||
'list':: | ||
Provide a list of the contents 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. | ||
+ | ||
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. | ||
|
||
'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. | ||
|
||
'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. | ||
|
||
SPARSE CHECKOUT | ||
--------------- | ||
|
||
"Sparse checkout" allows populating the working directory sparsely. | ||
It uses the skip-worktree bit (see linkgit:git-update-index[1]) to tell | ||
Git whether a file in the working directory is worth looking at. If | ||
the skip-worktree bit is set, then the file is ignored in the working | ||
directory. Git will not populate the contents of those files, which | ||
makes a sparse checkout helpful when working in a repository with many | ||
files, but only a few are important to the current user. | ||
|
||
The `$GIT_DIR/info/sparse-checkout` file is used to define the | ||
skip-worktree reference bitmap. When Git updates the working | ||
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 repopulate the working directory with all files, use the | ||
`git sparse-checkout disable` command. | ||
|
||
|
||
FULL PATTERN SET | ||
---------------- | ||
|
||
By default, the sparse-checkout file uses the same syntax as `.gitignore` | ||
files. | ||
|
||
While `$GIT_DIR/info/sparse-checkout` is usually used to specify what | ||
files are included, you can also specify what files are _not_ included, | ||
using negative patterns. For example, to remove the file `unwanted`: | ||
|
||
---------------- | ||
/* | ||
!unwanted | ||
---------------- | ||
|
||
|
||
CONE PATTERN SET | ||
---------------- | ||
|
||
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 | ||
now | ||
|
||
---------------- | ||
/* | ||
!/*/ | ||
/A/ | ||
!/A/*/ | ||
/A/B/ | ||
!/A/B/*/ | ||
/A/B/C/ | ||
---------------- | ||
|
||
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. | ||
|
||
SEE ALSO | ||
-------- | ||
|
||
linkgit:git-read-tree[1] | ||
linkgit:gitignore[5] | ||
|
||
GIT | ||
--- | ||
Part of the linkgit:git[1] suite |
Uh oh!
There was an error while loading. Please reload this page.