path: root/git.c
diff options
authorDerrick Stolee <>2019-11-21 22:04:33 (GMT)
committerJunio C Hamano <>2019-11-22 07:11:43 (GMT)
commit94c0956b60969bbbb3ead19638d52591a59d713c (patch)
treef0c12fc430aa90b015adb130705feff3c926c0d8 /git.c
parentd9f6f3b6195a0ca35642561e530798ad1469bd41 (diff)
sparse-checkout: create builtin with 'list' subcommand
The sparse-checkout feature is mostly hidden to users, as its only documentation is supplementary information in the docs for 'git read-tree'. In addition, users need to know how to edit the .git/info/sparse-checkout file with the right patterns, then run the appropriate 'git read-tree -mu HEAD' command. Keeping the working directory in sync with the sparse-checkout file requires care. Begin an effort to make the sparse-checkout feature a porcelain feature by creating a new 'git sparse-checkout' builtin. This builtin will be the preferred mechanism for manipulating the sparse-checkout file and syncing the working directory. The documentation provided is adapted from the "git read-tree" documentation with a few edits for clarity in the new context. Extra sections are added to hint toward a future change to a more restricted pattern set. Helped-by: Elijah Newren <> Signed-off-by: Derrick Stolee <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'git.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/git.c b/git.c
index ce6ab0e..7be7ad3 100644
--- a/git.c
+++ b/git.c
@@ -572,6 +572,7 @@ static struct cmd_struct commands[] = {
{ "show-branch", cmd_show_branch, RUN_SETUP },
{ "show-index", cmd_show_index },
{ "show-ref", cmd_show_ref, RUN_SETUP },
+ { "sparse-checkout", cmd_sparse_checkout, RUN_SETUP | NEED_WORK_TREE },
{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
* NEEDSWORK: Until the builtin stash is thoroughly robust and no