Subject: [PATCH v11 0/2] diff-files: integrate with sparse index

From: Shuqi Liang <[email-masked]>
Date: Mon, 8 May 2023 14:46:50 -0400

Changes since v10:

* Rewrite the comment before the "mkdir -p"

* Add " -- " in modified test to prevent regressions.

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 v10:
1:  3b284bdf3b ! 1:  3e96a0c136 t1092: add tests for `git diff-files`
    @@ t/t1092-sparse-checkout-compatibility.sh: test_expect_success 'sparse-index is n
     +	echo text >>"$1"
     +	EOF
     +
    -+	# Add file to the index but outside of cone for sparse-checkout cases.
    -+	# Add file to the index without sparse-checkout cases to ensure all have
    -+	# same output.
    ++	# The directory "folder1" is outside the cone of interest
    ++	# and may not exist in the sparse checkout repositories.
    ++	# Create it as needed, add file "folder1/a" there with
    ++	# contents that is different from the staged version.
     +	run_on_all mkdir -p folder1 &&
     +	run_on_all cp a folder1/a &&
     +
    -+	# file present on-disk with modifications
     +	run_on_all ../edit-contents folder1/a &&
     +	test_all_match git diff-files &&
    -+	test_all_match git diff-files folder1/a &&
    -+	test_all_match git diff-files "folder*/a"
    ++	test_all_match git diff-files -- folder1/a &&
    ++	test_all_match git diff-files -- "folder*/a"
     +'
     +
      test_done
2:  15472db302 ! 2:  2c53fedf08 diff-files: integrate with sparse index
    @@ t/t1092-sparse-checkout-compatibility.sh: ensure_not_expanded () {
      }
      
     @@ t/t1092-sparse-checkout-compatibility.sh: test_expect_success 'diff-files with pathspec outside sparse definition' '
    - 	test_all_match git diff-files "folder*/a"
    + 	test_all_match git diff-files -- "folder*/a"
      '
      
     +test_expect_success 'sparse index is not expanded: diff-files' '
-- 
2.39.0