--- v3
+++ v2
@@ -62,14 +62,6 @@
* Added patches that remove the use of 'test-tool read-cache --table' and
its implementation.
-
-Updates in v3
-=============
-
- * Fixed typo in commit message.
- * Added comments around doing strange things in an ls-files test.
- * Fixed adjacent typo in a test comment.
-
Derrick Stolee (5):
fetch/pull: use the sparse index
ls-files: add --sparse option
@@ -79,69 +71,117 @@
Documentation/git-ls-files.txt | 4 +
builtin/fetch.c | 2 +
- builtin/ls-files.c | 12 +-
+ builtin/ls-files.c | 12 ++-
builtin/pull.c | 2 +
t/helper/test-read-cache.c | 64 ++---------
t/t1091-sparse-checkout-builtin.sh | 25 ++++-
- t/t1092-sparse-checkout-compatibility.sh | 137 ++++++++++++++++++++---
+ t/t1092-sparse-checkout-compatibility.sh | 129 ++++++++++++++++++++---
t/t3705-add-sparse-checkout.sh | 8 +-
- 8 files changed, 172 insertions(+), 82 deletions(-)
+ 8 files changed, 165 insertions(+), 81 deletions(-)
base-commit: 3fffe69d24e4ecc95246766f5396303a953695ff
-Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1080%2Fderrickstolee%2Fsparse-index%2Ffetch-pull-ls-files-v3
-Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1080/derrickstolee/sparse-index/fetch-pull-ls-files-v3
+Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1080%2Fderrickstolee%2Fsparse-index%2Ffetch-pull-ls-files-v2
+Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1080/derrickstolee/sparse-index/fetch-pull-ls-files-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1080
-Range-diff vs v2:
+Range-diff vs v1:
- 1: f72001638d1 = 1: f72001638d1 fetch/pull: use the sparse index
- 2: 58b5eca4835 ! 2: b81174ba54b ls-files: add --sparse option
+ 1: 451056e1a77 ! 1: f72001638d1 fetch/pull: use the sparse index
+ @@ builtin/pull.c: int cmd_pull(int argc, const char **argv, const char *prefix)
+
+ ## t/t1092-sparse-checkout-compatibility.sh ##
+ @@ t/t1092-sparse-checkout-compatibility.sh: test_expect_success 'sparse index is not expanded: blame' '
+ - ensure_not_expanded blame deep/deeper1/deepest/a
+ + done
+ '
+
+ +test_expect_success 'sparse index is not expanded: fetch/pull' '
+ 2: e42c0feec94 ! 2: 58b5eca4835 ls-files: add --sparse option
@@ t/t1092-sparse-checkout-compatibility.sh: test_expect_success 'sparse index is n
- + git -C sparse-checkout ls-files --sparse >sparse &&
- + test_cmp dense sparse &&
+ + test_all_match git ls-files &&
+
- ++ # Set up a strange condition of having a file edit
- ++ # outside of the sparse-checkout cone. This is just
- ++ # to verify that sparse-checkout and sparse-index
- ++ # behave the same in this case.
+ + # With --sparse, the sparse index data changes behavior.
+ -+ git -C sparse-index ls-files --sparse >sparse-index-out &&
+ -+ grep "^folder1/\$" sparse-index-out &&
+ -+ grep "^folder2/\$" sparse-index-out &&
+ ++ git -C sparse-index ls-files >dense &&
+ ++ git -C sparse-index ls-files --sparse >sparse &&
+ ++
+ ++ cat >expect <<-\EOF &&
+ ++ @@ -13,13 +13,9 @@
+ ++ e
+ ++ folder1-
+ ++ folder1.x
+ ++ -folder1/0/0/0
+ ++ -folder1/0/1
+ ++ -folder1/a
+ ++ +folder1/
+ ++ folder10
+ ++ -folder2/0/0/0
+ ++ -folder2/0/1
+ ++ -folder2/a
+ ++ +folder2/
+ ++ g
+ ++ -x/a
+ ++ +x/
+ ++ z
+ ++ EOF
+ ++
+ ++ diff -u dense sparse | tail -n +3 >actual &&
+ ++ test_cmp expect actual &&
+ +
+ + # With --sparse and no sparse index, nothing changes.
+ -+ git -C sparse-checkout ls-files --sparse >sparse-checkout-out &&
+ -+ grep "^folder1/0/0/0\$" sparse-checkout-out &&
+ -+ ! grep "/\$" sparse-checkout-out &&
+ ++ git -C sparse-checkout ls-files >dense &&
+ ++ git -C sparse-checkout ls-files --sparse >sparse &&
+ ++ test_cmp dense sparse &&
+ +
+ write_script edit-content <<-\EOF &&
+ mkdir folder1 &&
- + echo content >>folder1/a
- + EOF
- + run_on_sparse ../edit-content &&
+ @@ t/t1092-sparse-checkout-compatibility.sh: test_expect_success 'sparse index is n
+ + git -C sparse-index ls-files --sparse --modified >sparse-index-out &&
+ + test_must_be_empty sparse-index-out &&
+
- -+ # ls-files does not notice modified files whose
- -+ # cache entries are marked SKIP_WORKTREE.
- ++ # ls-files does not currently notice modified files whose
- ++ # cache entries are marked SKIP_WORKTREE. This may change
- ++ # in the future, but here we test that sparse index does
- ++ # not accidentally create a change of behavior.
+ -+ run_on_sparse git sparse-checkout add folder1 &&
+ ++ # Add folder1 to the sparse-checkout cone and
+ ++ # check that ls-files shows the expanded files.
+ ++ test_sparse_match git sparse-checkout add folder1 &&
+ test_sparse_match git ls-files --modified &&
- + test_must_be_empty sparse-checkout-out &&
- + test_must_be_empty sparse-index-out &&
- 3: 5ffae2a03ae ! 3: 2a6a1c5a39c t1092: replace 'read-cache --table' with 'ls-files --sparse'
- @@ t/t1092-sparse-checkout-compatibility.sh: test_sparse_unstaged () {
- || return 1
- done &&
-
- - # Disabling the sparse-index removes tree entries with full ones
- +- # Disabling the sparse-index removes tree entries with full ones
- ++ # Disabling the sparse-index replaces tree entries with full ones
- git -C sparse-index sparse-checkout init --no-sparse-index &&
- -
- - test-tool -C sparse-index read-cache --table >cache &&
- 4: b98e5e6d2bc ! 4: f0143686754 t1091/t3705: remove 'test-tool read-cache --table'
- @@ Commit message
- t3705-add-sparse-checkout.sh.
-
- The important changes are due to the different output format. In t3705,
- - wWe need to use the '--stage' output to get a file mode and OID, but
- + we need to use the '--stage' output to get a file mode and OID, but
- it also includes a stage value and drops the object type. This leads
- to some differences in how we handle looking for specific entries.
-
- 5: f31a24eeb9b = 5: 9227dc54165 test-read-cache: remove --table, --expand options
+ -+ grep "^folder1/a\$" sparse-checkout-out &&
+ -+ grep "^folder1/a\$" sparse-index-out &&
+ +
+ -+ # Double-check index expansion
+ ++ git -C sparse-index ls-files >dense &&
+ ++ git -C sparse-index ls-files --sparse >sparse &&
+ ++
+ ++ cat >expect <<-\EOF &&
+ ++ @@ -17,9 +17,7 @@
+ ++ folder1/0/1
+ ++ folder1/a
+ ++ folder10
+ ++ -folder2/0/0/0
+ ++ -folder2/0/1
+ ++ -folder2/a
+ ++ +folder2/
+ ++ g
+ ++ -x/a
+ ++ +x/
+ ++ z
+ ++ EOF
+ ++
+ ++ diff -u dense sparse | tail -n +3 >actual &&
+ ++ test_cmp expect actual &&
+ ++
+ ++ # Double-check index expansion is avoided
+ + ensure_not_expanded ls-files --sparse
+ +'
+ +
+ -: ----------- > 3: 5ffae2a03ae t1092: replace 'read-cache --table' with 'ls-files --sparse'
+ -: ----------- > 4: b98e5e6d2bc t1091/t3705: remove 'test-tool read-cache --table'
+ -: ----------- > 5: f31a24eeb9b test-read-cache: remove --table, --expand options
--
gitgitgadget