git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Victoria Dye <vdye@github.com>,
	Derrick Stolee <stolee@gmail.com>,
	Lessley Dennington <lessleydennington@gmail.com>,
	Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v2 3/5] repo_read_index: clear SKIP_WORKTREE bit from files present in worktree
Date: Wed, 16 Feb 2022 09:57:54 +0100	[thread overview]
Message-ID: <220216.86o837uqak.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <11d46a399d26c913787b704d2b7169cafc28d639.1642175983.git.gitgitgadget@gmail.com>


On Fri, Jan 14 2022, Elijah Newren via GitGitGadget wrote:

> From: Elijah Newren <newren@gmail.com>
> [...]
>  	# 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.
> +	# outside of the sparse-checkout cone. We want to verify
> +	# that all modes handle this the same, and detect the
> +	# modification.
>  	write_script edit-content <<-\EOF &&
> -	mkdir folder1 &&
> +	mkdir -p folder1 &&
>  	echo content >>folder1/a
>  	EOF
> -	run_on_sparse ../edit-content &&
> +	run_on_all ../edit-content &&

The end-state of this series will pass its tests with this on top, only
the last "mkdir -p" you added for the ls-files test seems to do
anything:

diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index 2a04b532f91..160c119e17d 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -639,7 +639,7 @@ test_expect_success 'update-index modify outside sparse definition' '
 	# condition in which a `skip-worktree` enabled, outside-of-cone file
 	# exists on disk. It is used here to ensure `update-index` is stable
 	# and behaves predictably if such a condition occurs.
-	run_on_sparse mkdir -p folder1 &&
+	run_on_sparse mkdir folder1 &&
 	run_on_sparse cp ../initial-repo/folder1/a folder1/a &&
 	run_on_all ../edit-contents folder1/a &&
 
@@ -665,7 +665,7 @@ test_expect_success 'update-index --add outside sparse definition' '
 	EOF
 
 	# Create folder1, add new file
-	run_on_sparse mkdir -p folder1 &&
+	run_on_sparse mkdir folder1 &&
 	run_on_all ../edit-contents folder1/b &&
 
 	# The *untracked* out-of-cone file is added to the index because it does
@@ -949,7 +949,7 @@ test_expect_success 'checkout-index outside sparse definition' '
 
 	run_on_sparse rm -rf folder1 &&
 	echo test >new-a &&
-	run_on_sparse mkdir -p folder1 &&
+	run_on_sparse mkdir folder1 &&
 	run_on_all cp ../new-a folder1/a &&
 
 	test_all_match test_must_fail git checkout-index --ignore-skip-worktree-bits -- folder1/a &&
@@ -996,7 +996,7 @@ test_expect_success 'clean' '
 	test_all_match git commit -m "ignore bogus files" &&
 
 	run_on_sparse mkdir folder1 &&
-	run_on_all mkdir -p deep/untracked-deep &&
+	run_on_all mkdir deep/untracked-deep &&
 	run_on_all touch folder1/bogus &&
 	run_on_all touch folder1/untracked &&
 	run_on_all touch deep/untracked-deep/bogus &&

A bit nit-y I guess, but I do think tests are much easier to follow when
it's clear when we're doing initial setup v.s. using already set-up
data. In this case 

More importantnly I think between this and 19a0acc83e4 (t1092: test
interesting sparse-checkout scenarios, 2021-01-23) that introduced this
pattern there's a large foot-gun being left in place here by using these
"run_on_all" and "run_on_sparse" helpers to run POSIX tooling, as
opposed to git itself.

Utilities like "mv", "rm", "mkdir" etc. are differently chatty between
platform, and this helper captures their stdout/stderr for a later
test_cmp.

Now, I think actually there isn't a bug *now* because we clobber the
output, and seem to only call test_all_match() and other test_cmp
helpers right after we've run "git", not these POSIX utilities.

But since all we want in those cases is just a "run these commands in
these N dirs" it would be good to split up the helper.



  reply	other threads:[~2022-02-16  9:14 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 16:43 [PATCH 0/5] Remove the present-despite-SKIP_WORKTREE class of bugs (for sparse-checkouts) Elijah Newren via GitGitGadget
2022-01-13 16:43 ` [PATCH 1/5] t1011: add testcase demonstrating accidental loss of user modifications Elijah Newren via GitGitGadget
2022-01-13 16:43 ` [PATCH 2/5] unpack-trees: fix accidental loss of user changes Elijah Newren via GitGitGadget
2022-01-13 16:43 ` [PATCH 3/5] repo_read_index: clear SKIP_WORKTREE bit from files present in worktree Elijah Newren via GitGitGadget
2022-01-13 16:43 ` [PATCH 4/5] Update documentation related to sparsity and the skip-worktree bit Elijah Newren via GitGitGadget
2022-01-13 16:43 ` [PATCH 5/5] Accelerate clear_skip_worktree_from_present_files() by caching Elijah Newren via GitGitGadget
2022-01-13 23:35   ` Elijah Newren
2022-01-14 15:59 ` [PATCH v2 0/5] Remove the present-despite-SKIP_WORKTREE class of bugs (for sparse-checkouts) Elijah Newren via GitGitGadget
2022-01-14 15:59   ` [PATCH v2 1/5] t1011: add testcase demonstrating accidental loss of user modifications Elijah Newren via GitGitGadget
2022-02-16  8:51     ` Ævar Arnfjörð Bjarmason
2022-02-16 16:02       ` Elijah Newren
2022-01-14 15:59   ` [PATCH v2 2/5] unpack-trees: fix accidental loss of user changes Elijah Newren via GitGitGadget
2022-01-14 15:59   ` [PATCH v2 3/5] repo_read_index: clear SKIP_WORKTREE bit from files present in worktree Elijah Newren via GitGitGadget
2022-02-16  8:57     ` Ævar Arnfjörð Bjarmason [this message]
2022-02-16 16:08       ` Elijah Newren
2022-02-19  1:06     ` Jonathan Nieder
2022-02-19 16:42       ` Elijah Newren
2022-02-19 18:14         ` Jonathan Nieder
2022-02-20  5:28           ` Elijah Newren
2022-02-20 16:56       ` Derrick Stolee
2022-02-22 23:17         ` Jonathan Nieder
2022-01-14 15:59   ` [PATCH v2 4/5] Update documentation related to sparsity and the skip-worktree bit Elijah Newren via GitGitGadget
2022-02-16  9:15     ` Ævar Arnfjörð Bjarmason
2022-02-16 16:21       ` Elijah Newren
2022-01-14 15:59   ` [PATCH v2 5/5] Accelerate clear_skip_worktree_from_present_files() by caching Elijah Newren via GitGitGadget
2022-01-15  1:39     ` Victoria Dye
2022-02-16  9:32     ` Ævar Arnfjörð Bjarmason
2022-02-16 16:30       ` Elijah Newren
2022-02-17  4:40         ` Elijah Newren
2022-01-15  1:51   ` [PATCH v2 0/5] Remove the present-despite-SKIP_WORKTREE class of bugs (for sparse-checkouts) Victoria Dye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220216.86o837uqak.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=lessleydennington@gmail.com \
    --cc=newren@gmail.com \
    --cc=stolee@gmail.com \
    --cc=vdye@github.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).