[PATCH v10 0/2] diff-files: integrate with sparse index
From: Shuqi Liang <hidden>
Date: 2023-05-03 21:56:22
Changes since v9:
* Replace the unhelpful test with a double-dash case to prevent
regressions.
* Remove the unmodified test because its empty output could pass
even with an index expansion issue.
* Update the relevant commit message.
* Did not add " -- " in modified test as suggested sine
"folder1/a" exists in the working tree
Shuqi Liang (2):
t1092: add tests for `git diff-files`
diff-files: integrate with sparse index
builtin/diff-files.c | 4 ++
t/perf/p2000-sparse-operations.sh | 2 +
t/t1092-sparse-checkout-compatibility.sh | 66 +++++++++++++++++++++++-
3 files changed, 70 insertions(+), 2 deletions(-)
Range-diff against v9:
1: d78513af83 ! 1: 3b284bdf3b t1092: add tests for `git diff-files`
@@ Commit message
make a directory called 'folder1' and copy `a` into 'folder1/a'.
'folder1/a' is identical to `a` in the base commit. These make
'folder1/a' in the index, while leaving it outside of the
- sparse-checkout definition. Test 'folder1/a'being present on-disk
- without modifications, then change content inside 'folder1/a' in order
+ sparse-checkout definition. Change content inside 'folder1/a' in order
to test 'folder1/a' being present on-disk with modifications.
Signed-off-by: Shuqi Liang [off-list ref]
@@ t/t1092-sparse-checkout-compatibility.sh: test_expect_success 'sparse-index is n
+test_expect_success 'diff-files with pathspec outside sparse definition' '
+ init_repos &&
+
-+ test_sparse_match test_must_fail git diff-files folder2/a &&
++ test_sparse_match git diff-files -- folder2/a &&
+
+ write_script edit-contents <<-\EOF &&
+ echo text >>"$1"
@@ t/t1092-sparse-checkout-compatibility.sh: test_expect_success 'sparse-index is n
+ run_on_all mkdir -p folder1 &&
+ run_on_all cp a folder1/a &&
+
-+ # file present on-disk without modifications
-+ # use `--stat` to ignore file creation time differences in
-+ # unrefreshed index
-+ test_all_match git diff-files --stat &&
-+ test_all_match git diff-files --stat folder1/a &&
-+ test_all_match git diff-files --stat "folder*/a" &&
-+
+ # file present on-disk with modifications
+ run_on_all ../edit-contents folder1/a &&
+ test_all_match git diff-files &&
2: a2454befa0 = 2: 15472db302 diff-files: integrate with sparse index
--
2.39.0