git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] diff-files: integrate with sparse index
@ 2023-03-07  6:45 Shuqi Liang
  2023-03-07  6:45 ` [PATCH v2 1/2] t1092: add tests for `git diff-files` Shuqi Liang
  2023-03-07  6:45 ` [PATCH v2 2/2] diff-files: integrate with sparse index Shuqi Liang
  0 siblings, 2 replies; 7+ messages in thread
From: Shuqi Liang @ 2023-03-07  6:45 UTC (permalink / raw)
  To: git; +Cc: Shuqi Liang, vdye, derrickstolee

Turn on sparse-index feature within `git diff-files` command.
Add necessary modifications and test them.

Changes since v1:

1.Add an empty line between the previous test's closing quote
and the start of new test.

2.Use "git add --sparse newdirectory/testfile" instead of 
'git sparse-checkout set' to have staged changes outside 
of the sparse-checkout cone

3.Edit commit message to be more informative


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 | 52 ++++++++++++++++++++++++
 3 files changed, 58 insertions(+)


base-commit: a38d39a4c50d1275833aba54c4dbdfce9e2e9ca1
-- 
2.39.0


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [RFC][PATCH] t1092: add tests for `git diff-files`
@ 2023-03-04  2:57 Shuqi Liang
  2023-03-07  6:58 ` [PATCH v2 0/2] diff-files: integrate with sparse index Shuqi Liang
  0 siblings, 1 reply; 7+ messages in thread
From: Shuqi Liang @ 2023-03-04  2:57 UTC (permalink / raw)
  To: git; +Cc: Shuqi Liang, vdye, derrickstolee

To make sure git diff-files behaves as expected when
inside or outside of sparse-checkout definition.

Add test for git diff-files:
Path is within sparse-checkout cone
Path is outside sparse-checkout cone

Signed-off-by: Shuqi Liang <cheskaqiqi@gmail.com>
---
 t/t1092-sparse-checkout-compatibility.sh | 32 ++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index 801919009e..f4815c619a 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -2054,5 +2054,37 @@ test_expect_success 'grep sparse directory within submodules' '
 	git grep --cached --recurse-submodules a -- "*/folder1/*" >actual &&
 	test_cmp actual expect
 '
+test_expect_success 'diff-files with pathspec inside sparse definition' '
+	init_repos &&
+
+	write_script edit-contents <<-\EOF &&
+	echo text >>$1
+	EOF
+
+	run_on_all ../edit-contents deep/a &&
+
+	test_all_match git diff-files  &&
+	test_all_match git diff-files deep/a &&
+	test_all_match git diff-files --find-object=HEAD:a
+'
+
+test_expect_success 'diff-files with pathspec outside sparse definition' '
+	init_repos &&
+
+	write_script edit-contents <<-\EOF &&
+	echo text >>$1
+	EOF
+
+	run_on_sparse mkdir newdirectory &&
+	run_on_sparse ../edit-contents newdirectory/testfile &&
+	test_sparse_match git sparse-checkout set newdirectory &&
+	test_sparse_match git add newdirectory/testfile &&
+	run_on_sparse ../edit-contents newdirectory/testfile &&
+	test_sparse_match git sparse-checkout set &&
+
+	test_sparse_match git diff-files &&
+	test_sparse_match git diff-files newdirectory/testfile &&
+	test_sparse_match test_must_fail git diff-files --find-object=HEAD:testfile
+'
 
 test_done
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-08 22:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-07  6:45 [PATCH v2 0/2] diff-files: integrate with sparse index Shuqi Liang
2023-03-07  6:45 ` [PATCH v2 1/2] t1092: add tests for `git diff-files` Shuqi Liang
2023-03-07  6:45 ` [PATCH v2 2/2] diff-files: integrate with sparse index Shuqi Liang
  -- strict thread matches above, loose matches on Subject: below --
2023-03-04  2:57 [RFC][PATCH] t1092: add tests for `git diff-files` Shuqi Liang
2023-03-07  6:58 ` [PATCH v2 0/2] diff-files: integrate with sparse index Shuqi Liang
2023-03-07  6:58   ` [PATCH v2 1/2] t1092: add tests for `git diff-files` Shuqi Liang
2023-03-07 18:53     ` Junio C Hamano
2023-03-08 22:04       ` Shuqi Liang
2023-03-08 22:40         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).