Skip to content

RFC Sparse checkout

Nguyễn Thái Ngọc Duy git 5 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 RFC Latest19 patches 7 repliesIn review
  2. v3 RFC8 patches 44 repliesSuperseded
  3. v2 RFC posting 2/24 patches 14 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 posting 1/214 patches22 repliesSuperseded
v116 patches18 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19update-index: refactor mark_valid() in preparation for new optionsbuiltin-update-index.c+10 -140 replies
2/19Add test-index-version.gitignore Makefile test-index-version.c+16 -00 replies
3/19Introduce "skip-worktree" bit in index, teach Git to get/set this bitDocumentation/git-ls-files.txt Documentation/git-update-index.txt builtin-ls-files.c +3 more+109 -30 replies
4/19Teach Git to respect skip-worktree bit (reading part)builtin-commit.c builtin-grep.c builtin-ls-files.c +5 more+199 -263 replies
5/19Teach Git to respect skip-worktree bit (writing part)t/t7012-skip-worktree-writing.sh unpack-trees.c+148 -20 replies
6/19Avoid writing to buffer in add_excludes_from_file_1()dir.c+2 -30 replies
7/19Read .gitignore from index if it is skip-worktreeDocumentation/technical/api-directory-listing.txt builtin-clean.c builtin-ls-files.c +3 more+95 -220 replies
8/19unpack-trees(): carry skip-worktree bit over in merged_entry()unpack-trees.c+2 -00 replies
9/19excluded_1(): support exclude files in indexdir.c+6 -00 replies
10/19dir.c: export excluded_1() and add_excludes_from_file_1()dir.c dir.h+20 -160 replies
11/19Introduce "sparse checkout"Documentation/git-read-tree.txt+44 -00 replies
12/19unpack-trees(): add CE_WT_REMOVE to remove on worktree alonecache.h unpack-trees.c+11 -10 replies
13/19unpack-trees.c: generalize verify_* functionsunpack-trees.c+18 -50 replies
14/19unpack-trees(): "enable" sparse checkout and load $GIT_DIR/info/sparse-checkoutDocumentation/config.txt Documentation/git-read-tree.txt cache.h +4 more+48 -70 replies
15/19unpack_trees(): apply $GIT_DIR/info/sparse-checkout to the final indexunpack-trees.c unpack-trees.h+83 -10 replies
16/19unpack-trees(): ignore worktree check outside checkout areaunpack-trees.c+12 -00 replies
17/19read-tree: add --no-sparse-checkout to disable sparse checkout supportDocumentation/git-read-tree.txt builtin-read-tree.c+8 -20 replies
18/19Add tests for sparse checkoutt/t1009-read-tree-sparse-checkout.sh+154 -00 replies
19/19sparse checkout: inhibit empty worktreet/t1009-read-tree-sparse-checkout.sh unpack-trees.c+10 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [RFC PATCH v4 00/19] Sparse checkout

Welcome to the fourth round of sparse checkout this year, dubbed "The mummy^W^W^W^W^Wno-checkout returns", although the bit now comes under a new name "skip-worktree" [1]. This series has two parts: sparse worktree and sparse checkout. Details will be given below.

For brave users of this series: I have pushed it to my sparse-checkout branch [2] so you can just clone it and test away. Visible changes:

- the spec is now .git/info/sparse-checkout
- the spec is positive matching, that is it matches what _is_ in worktree, not what is out of worktree like the last series
- you need to set core.sparsecheckout no additional command argument is needed.

Except from running tests, I have only used it a little bit, so be careful, it may burn your trees.

Nguyễn Thái Ng�c Duy (8):
update-index: refactor mark_valid() in preparation for new options Add test-index-version
Introduce "skip-worktree" bit in index, teach Git to get/set this bit Teach Git to respect skip-worktree bit (reading part) Teach Git to respect skip-worktree bit (writing part) Avoid writing to buffer in add_excludes_from_file_1()
Read .gitignore from index if it is skip-worktree unpack-trees(): carry skip-worktree bit over in merged_entry()

The three main patches in this part are 3, 4 and 5, which define how "skip-worktree" should work (and I'd love to have feedback whether I get it right) and implement it.

.gitignore patches are from last series and do not change much.

Nguyễn Thái Ng�c Duy (11):
excluded_1(): support exclude files in index
dir.c: export excluded_1() and add_excludes_from_file_1() Introduce "sparse checkout"
unpack-trees(): add CE_WT_REMOVE to remove on worktree alone unpack-trees.c: generalize verify_* functions unpack-trees(): "enable" sparse checkout and load
$GIT_DIR/info/sparse-checkout
unpack_trees(): apply $GIT_DIR/info/sparse-checkout to the final
index
unpack-trees(): ignore worktree check outside checkout area
read-tree: add --no-sparse-checkout to disable sparse checkout
support
Add tests for sparse checkout
sparse checkout: inhibit empty worktree

The recent assume-unchanged "breakage" that lets Git overwrite assume-unchanged files worried me. I sat back, checked and wrote tests to catch similar situations. As a result, core sparse checkout code becomes more complicated and is splitted into smaller parts for easier read.

Interesting patches are 11/19 (OK not that interesting, it's just boring text), 14/19-16/19. Patch 18/19 also covers "foo" vs "foo/" matching bug in tests.

[1] There are a few reasons behind this rename:
- there is nothing about "checkout" in the first part, it's about "sparse worktree"
- the double negation issue with "no-" part of "no-checkout"
- new name makes cache.h diff align beautifully

[2] http://repo.or.cz/w/git/pclouds.git?a=shortlog;h=refs/heads/sparse-checkout

 .gitignore                                        |    1 +
 Documentation/config.txt                          |    4 +
 Documentation/git-ls-files.txt                    |    1 +
 Documentation/git-read-tree.txt                   |   52 ++++++-
 Documentation/git-update-index.txt                |   29 ++++
 Documentation/technical/api-directory-listing.txt |    3 +
 Makefile                                          |    1 +
 builtin-clean.c                                   |    4 +-
 builtin-commit.c                                  |    5 +
 builtin-grep.c                                    |    2 +-
 builtin-ls-files.c                                |   11 +-
 builtin-read-tree.c                               |    4 +-
 builtin-update-index.c                            |   78 ++++++----
 cache.h                                           |    8 +-
 config.c                                          |    5 +
 diff-lib.c                                        |    5 +-
 diff.c                                            |    2 +-
 dir.c                                             |  100 ++++++++----
 dir.h                                             |    4 +
 environment.c                                     |    1 +
 read-cache.c                                      |    8 +-
 t/t1009-read-tree-sparse-checkout.sh              |  150 ++++++++++++++++++
 t/t2104-update-index-skip-worktree.sh             |   57 +++++++
 t/t3001-ls-files-others-exclude.sh                |   22 +++
 t/t7011-skip-worktree-reading.sh                  |  163 +++++++++++++++++++
 t/t7012-skip-worktree-writing.sh                  |  146 +++++++++++++++++
 t/t7300-clean.sh                                  |   19 +++
 test-index-version.c                              |   14 ++
 unpack-trees.c                                    |  175 +++++++++++++++++++--
 unpack-trees.h                                    |    6 +
 30 files changed, 983 insertions(+), 97 deletions(-)
 create mode 100755 t/t1009-read-tree-sparse-checkout.sh
 create mode 100755 t/t2104-update-index-skip-worktree.sh
 create mode 100755 t/t7011-skip-worktree-reading.sh
 create mode 100755 t/t7012-skip-worktree-writing.sh
 create mode 100644 test-index-version.c