Re: [PATCH v3 01/14] t3705: test that 'sparse_entry' is unstaged
flat view
From: Junio C Hamano <hidden>
Date: 2021-09-22 22:52:35
"Derrick Stolee via GitGitGadget" [off-list ref] writes:
quoted hunk
From: Derrick Stolee <redacted> The tests in t3705-add-sparse-checkout.sh check to see how 'git add' behaves with paths outside the sparse-checkout definition. These currently check to see if a given warning is present but not that the index is not updated with the sparse entries. Add a new 'test_sparse_entry_unstaged' helper to be sure 'git add' is behaving correctly. We need to modify setup_sparse_entry to actually commit the sparse_entry file so it exists at HEAD and as an entry in the index, but its exact contents are not staged in the index. Signed-off-by: Derrick Stolee <redacted> --- t/t3705-add-sparse-checkout.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+)diff --git a/t/t3705-add-sparse-checkout.sh b/t/t3705-add-sparse-checkout.sh index 2b1fd0d0eef..e202a2ff74a 100755 --- a/t/t3705-add-sparse-checkout.sh +++ b/t/t3705-add-sparse-checkout.sh@@ -19,6 +19,7 @@ setup_sparse_entry () { fi && git add sparse_entry && git update-index --skip-worktree sparse_entry && + git commit --allow-empty -m "ensure sparse_entry exists at HEAD" && SPARSE_ENTRY_BLOB=$(git rev-parse :sparse_entry) }@@ -36,6 +37,11 @@ setup_gitignore () { EOF } +test_sparse_entry_unstaged () { + git status --porcelain >actual && + ! grep "^[MDARCU][M ] sparse_entry\$" actual
Does this say "we do not want any difference from the index, be it modification, deletion, addtion, etc."? Just wondering if there were a reason why the pattern is more complex than "^[^ ][M ]" (i.e. anything but "unmodified since the index"), not necessarily suggesting to spell the test differently. Thanks.