git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 3/5] repo_read_index: clear SKIP_WORKTREE bit from files present in worktree

From
Elijah Newren <newren@gmail.com>
Date
Feb 16, 2022, 16:08 UTC
Message-ID
<CABPp-BHsZ=TPfJ-wohpmYVMAD_3umAffNqV+EXn0xr0cDBRzpw@mail.gmail.com>
In-Reply-To
<220216.86o837uqak.gmgdl@evledraar.gmail.com>

On Wed, Feb 16, 2022 at 1:14 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 85 quoted lines
>
> 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.

Maybe, but that sounds like a comment on the series from 13 months ago rather than this series. It's somewhat orthogonal to what I'm doing here... ;-)

Previous: Ævar Arnfjörð BjarmasonNext: Jonathan Nieder
Message 15 of 30 in “Remove the present-despite-SKIP_WORKTREE class of bugs (for sparse-checkouts)”
  1. 0/5 Remove the present-despite-SKIP_WORKTREE class of bugs (for sparse-checkouts)Elijah Newren via GitGitGadget, Jan 13, 2022
  2. 1/5 t1011: add testcase demonstrating accidental loss of user modificationsElijah Newren via GitGitGadget, Jan 13, 2022
  3. 2/5 unpack-trees: fix accidental loss of user changesElijah Newren via GitGitGadget, Jan 13, 2022
  4. 3/5 repo_read_index: clear SKIP_WORKTREE bit from files present in worktreeElijah Newren via GitGitGadget, Jan 13, 2022
  5. 4/5 Update documentation related to sparsity and the skip-worktree bitElijah Newren via GitGitGadget, Jan 13, 2022
  6. 5/5 Accelerate clear_skip_worktree_from_present_files() by cachingElijah Newren via GitGitGadget, Jan 13, 2022
  7. Elijah NewrenJan 13, 2022
  8. 0/5 Remove the present-despite-SKIP_WORKTREE class of bugs (for sparse-checkouts)Elijah Newren via GitGitGadget, Jan 14, 2022
  9. 1/5 t1011: add testcase demonstrating accidental loss of user modificationsElijah Newren via GitGitGadget, Jan 14, 2022
  10. Ævar Arnfjörð BjarmasonFeb 16, 2022
  11. Elijah NewrenFeb 16, 2022
  12. 2/5 unpack-trees: fix accidental loss of user changesElijah Newren via GitGitGadget, Jan 14, 2022
  13. 3/5 repo_read_index: clear SKIP_WORKTREE bit from files present in worktreeElijah Newren via GitGitGadget, Jan 14, 2022
  14. Ævar Arnfjörð BjarmasonFeb 16, 2022
  15. Elijah NewrenFeb 16, 2022
  16. Jonathan NiederFeb 19, 2022
  17. Elijah NewrenFeb 19, 2022
  18. Jonathan NiederFeb 19, 2022
  19. Elijah NewrenFeb 20, 2022
  20. Derrick StoleeFeb 20, 2022
  21. Jonathan NiederFeb 22, 2022
  22. 4/5 Update documentation related to sparsity and the skip-worktree bitElijah Newren via GitGitGadget, Jan 14, 2022
  23. Ævar Arnfjörð BjarmasonFeb 16, 2022
  24. Elijah NewrenFeb 16, 2022
  25. 5/5 Accelerate clear_skip_worktree_from_present_files() by cachingElijah Newren via GitGitGadget, Jan 14, 2022
  26. Victoria DyeJan 15, 2022
  27. Ævar Arnfjörð BjarmasonFeb 16, 2022
  28. Elijah NewrenFeb 16, 2022
  29. Elijah NewrenFeb 17, 2022
  30. Victoria DyeJan 15, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.