{"thread":{"id":"59837","subject":"[PATCH v1] worktree: integrate with sparse-index","startedAt":"2023-06-05T16:17:22Z","lastAt":"2023-06-07T17:21:30Z","messageCount":6,"participants":["Shuqi Liang","Victoria Dye"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"478049","messageId":"20230605161644.491424-1-cheskaqiqi@gmail.com","threadId":"59837","inReplyTo":null,"subject":"[PATCH v1] worktree: integrate with sparse-index","fromName":"Shuqi Liang","fromEmail":"cheskaqiqi@gmail.com","sentAt":"2023-06-05T16:16:44Z","receivedAt":"2023-06-05T16:17:22Z","isPatch":true,"sender":{"key":"cheskaqiqi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109261504?v=4"},"body":"The index is read in 'worktree.c' at two points:\n\n1.The 'validate_no_submodules' function, which checks if there are any\nsubmodules present in the worktree.\n\n2.The 'check_clean_worktree' function, which verifies if a worktree is\n'clean', i.e., there are no untracked or modified but uncommitted files.\nThis is done by running the 'git status' command, and an error message\nis thrown if the worktree is not clean. Given that 'git status' is\nalready sparse-aware, the function is also sparse-aware.\n\nHence we can just set the requires-full-index to false for\n\"git worktree\".\n\nAdd tests that verify that 'git worktree' behaves correctly when the\nsparse index is enabled and test to ensure the index is not expanded.\n\nThe `p2000` tests demonstrate a ~20% execution time reduction for\n'git worktree' using a sparse index:\n\n(Note:the p2000 test results did't reflect the huge speedup because of\nthe index reading time is minuscule comparing to the filesystem\noperations.)\n\nTest                                       before  after\n-----------------------------------------------------------------------\n2000.102: git worktree add....(full-v3)    3.15    2.82  -10.5%\n2000.103: git worktree add....(full-v4)    3.14    2.84  -9.6%\n2000.104: git worktree add....(sparse-v3)  2.59    2.14  -16.4%\n2000.105: git worktree add....(sparse-v4)  2.10    1.57  -25.2%\n\nHelped-by: Victoria Dye <vdye@github.com>\nSigned-off-by: Shuqi Liang <cheskaqiqi@gmail.com>\n---\n builtin/worktree.c                       |  4 ++++\n t/perf/p2000-sparse-operations.sh        |  1 +\n t/t1092-sparse-checkout-compatibility.sh | 23 +++++++++++++++++++++++\n 3 files changed, 28 insertions(+)\n\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex f3180463be..db14bff1a3 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -1200,5 +1200,9 @@ int cmd_worktree(int ac, const char **av, const char *prefix)\n \t\tprefix = \"\";\n \n \tac = parse_options(ac, av, prefix, options, git_worktree_usage, 0);\n+\n+\tprepare_repo_settings(the_repository);\n+\tthe_repository->settings.command_requires_full_index = 0;\n+\n \treturn fn(ac, av, prefix);\n }\ndiff --git a/t/perf/p2000-sparse-operations.sh b/t/perf/p2000-sparse-operations.sh\nindex 901cc493ef..1422136c73 100755\n--- a/t/perf/p2000-sparse-operations.sh\n+++ b/t/perf/p2000-sparse-operations.sh\n@@ -131,5 +131,6 @@ test_perf_on_all git describe --dirty\n test_perf_on_all 'echo >>new && git describe --dirty'\n test_perf_on_all git diff-files\n test_perf_on_all git diff-files -- $SPARSE_CONE/a\n+test_perf_on_all \"git worktree add ../temp && git worktree remove ../temp\"\n \n test_done\ndiff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh\nindex a63d0cc222..6ed691d338 100755\n--- a/t/t1092-sparse-checkout-compatibility.sh\n+++ b/t/t1092-sparse-checkout-compatibility.sh\n@@ -2180,4 +2180,27 @@ test_expect_success 'sparse index is not expanded: diff-files' '\n \tensure_not_expanded diff-files -- \"deep/*\"\n '\n \n+test_expect_success 'worktree' '\n+\tinit_repos &&\n+\n+\twrite_script edit-contents <<-\\EOF &&\n+\techo text >>\"$1\"\n+\tEOF\n+\n+\ttest_all_match git worktree add .worktrees/hotfix &&\n+\ttest_sparse_match ls .worktrees/hotfix &&\n+\ttest_all_match git worktree remove .worktrees/hotfix &&\n+\n+\ttest_all_match git worktree add .worktrees/hotfix &&\n+\trun_on_all ../edit-contents .worktrees/hotfix/deep/a &&\n+\ttest_all_match test_must_fail git worktree remove .worktrees/hotfix\n+'\n+\n+test_expect_success 'worktree is not expanded' '\n+\tinit_repos &&\n+\n+\ttest_all_match git worktree add .worktrees/hotfix &&\n+\tensure_not_expanded worktree remove .worktrees/hotfix\n+'\n+\n test_done\n-- \n2.39.0\n\n"},{"id":"478050","messageId":"773c2f7a-8637-ab0b-e0a8-ab553c90e88b@github.com","threadId":"59837","inReplyTo":"20230605161644.491424-1-cheskaqiqi@gmail.com","subject":"Re: [PATCH v1] worktree: integrate with sparse-index","fromName":"Victoria Dye","fromEmail":"vdye@github.com","sentAt":"2023-06-05T19:16:13Z","receivedAt":"2023-06-05T19:16:28Z","isPatch":true,"sender":{"key":"vdye@github.com","avatar":"https://avatars.githubusercontent.com/u/3619353?v=4"},"body":"Shuqi Liang wrote:\n> The index is read in 'worktree.c' at two points:\n> \n> 1.The 'validate_no_submodules' function, which checks if there are any\n> submodules present in the worktree.\n> \n> 2.The 'check_clean_worktree' function, which verifies if a worktree is\n> 'clean', i.e., there are no untracked or modified but uncommitted files.\n> This is done by running the 'git status' command, and an error message\n> is thrown if the worktree is not clean. Given that 'git status' is\n> already sparse-aware, the function is also sparse-aware.\n> \n> Hence we can just set the requires-full-index to false for\n> \"git worktree\".\n\nThanks for the detailed analysis! This lines up with my understanding of the\ncommand as well; I'm glad the sparse index integration is so straightforward\nhere!\n\n> \n> Add tests that verify that 'git worktree' behaves correctly when the\n> sparse index is enabled and test to ensure the index is not expanded.\n> \n> The `p2000` tests demonstrate a ~20% execution time reduction for\n> 'git worktree' using a sparse index:\n> \n> (Note:the p2000 test results did't reflect the huge speedup because of\n\ns/did't/didn't\n\n(not worth fixing if you don't end up re-rolling, though!)\n\n> the index reading time is minuscule comparing to the filesystem\n> operations.)\n> \n> Test                                       before  after\n> -----------------------------------------------------------------------\n> 2000.102: git worktree add....(full-v3)    3.15    2.82  -10.5%\n> 2000.103: git worktree add....(full-v4)    3.14    2.84  -9.6%\n> 2000.104: git worktree add....(sparse-v3)  2.59    2.14  -16.4%\n> 2000.105: git worktree add....(sparse-v4)  2.10    1.57  -25.2%\n> \n> Helped-by: Victoria Dye <vdye@github.com>\n> Signed-off-by: Shuqi Liang <cheskaqiqi@gmail.com>\n> ---\n>  builtin/worktree.c                       |  4 ++++\n>  t/perf/p2000-sparse-operations.sh        |  1 +\n>  t/t1092-sparse-checkout-compatibility.sh | 23 +++++++++++++++++++++++\n>  3 files changed, 28 insertions(+)\n> \n> diff --git a/builtin/worktree.c b/builtin/worktree.c\n> index f3180463be..db14bff1a3 100644\n> --- a/builtin/worktree.c\n> +++ b/builtin/worktree.c\n> @@ -1200,5 +1200,9 @@ int cmd_worktree(int ac, const char **av, const char *prefix)\n>  \t\tprefix = \"\";\n>  \n>  \tac = parse_options(ac, av, prefix, options, git_worktree_usage, 0);\n> +\n> +\tprepare_repo_settings(the_repository);\n> +\tthe_repository->settings.command_requires_full_index = 0;\n> +\n>  \treturn fn(ac, av, prefix);\n>  }\n> diff --git a/t/perf/p2000-sparse-operations.sh b/t/perf/p2000-sparse-operations.sh\n> index 901cc493ef..1422136c73 100755\n> --- a/t/perf/p2000-sparse-operations.sh\n> +++ b/t/perf/p2000-sparse-operations.sh\n> @@ -131,5 +131,6 @@ test_perf_on_all git describe --dirty\n>  test_perf_on_all 'echo >>new && git describe --dirty'\n>  test_perf_on_all git diff-files\n>  test_perf_on_all git diff-files -- $SPARSE_CONE/a\n> +test_perf_on_all \"git worktree add ../temp && git worktree remove ../temp\"\n\nThis, like the 'git stash' performance tests, involves multiple steps to\nensure we return to a clean state after the test is executed. Makes sense.\n\n>  \n>  test_done\n> diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh\n> index a63d0cc222..6ed691d338 100755\n> --- a/t/t1092-sparse-checkout-compatibility.sh\n> +++ b/t/t1092-sparse-checkout-compatibility.sh\n> @@ -2180,4 +2180,27 @@ test_expect_success 'sparse index is not expanded: diff-files' '\n>  \tensure_not_expanded diff-files -- \"deep/*\"\n>  '\n>  \n> +test_expect_success 'worktree' '\n> +\tinit_repos &&\n> +\n> +\twrite_script edit-contents <<-\\EOF &&\n> +\techo text >>\"$1\"\n> +\tEOF\n> +\n> +\ttest_all_match git worktree add .worktrees/hotfix &&\n> +\ttest_sparse_match ls .worktrees/hotfix &&\n\nI see why you're comparing 'sparse-checkout' to 'sparse-index' here (their\nworktrees should both contain only the files matched by the sparse-checkout\npatterns, unlike 'full-checkout' which will contain all files), but this\nwon't catch bugs that apply to both sparse-checkout and sparse-index (e.g.,\nif the sparse checkout patterns weren't applied and the full worktrees were\nchecked out). \n\nTo make sure that doesn't happen, you could add a section that compares each \ntest repo's default worktree to a new worktree, e.g.:\n\n\tfor repo in full-checkout sparse-checkout sparse-index\n\tdo\n\t\tworktree=${repo}-wt &&\n\t\tgit -C $repo worktree add $worktree &&\n\t\t\n\t\t# Compare worktree content with 'ls'\n\n\t\t# Compare index content with 'ls-files --sparse'\n\n\t\t# Any other comparisons that are useful\n\t\t\n\t\tgit worktree remove $worktree || return 1\n\tdone\n\n> +\ttest_all_match git worktree remove .worktrees/hotfix &&\n> +\n> +\ttest_all_match git worktree add .worktrees/hotfix &&\n> +\trun_on_all ../edit-contents .worktrees/hotfix/deep/a &&\n> +\ttest_all_match test_must_fail git worktree remove .worktrees/hotfix\n> +'\n> +\n> +test_expect_success 'worktree is not expanded' '\n> +\tinit_repos &&\n> +\n> +\ttest_all_match git worktree add .worktrees/hotfix &&\n\nShouldn't 'git worktree add' not expand the index? Why use 'test_all_match'\ninstead of 'ensure_not_expanded'?\n\n> +\tensure_not_expanded worktree remove .worktrees/hotfix> +'\n> +\n>  test_done\n\n"},{"id":"478053","messageId":"CAMO4yUEQZz8DqPb7RyN8Owb=23p==6XS6G7Bza77p4-iydo6Qg@mail.gmail.com","threadId":"59837","inReplyTo":"773c2f7a-8637-ab0b-e0a8-ab553c90e88b@github.com","subject":"Re: [PATCH v1] worktree: integrate with sparse-index","fromName":"Shuqi Liang","fromEmail":"cheskaqiqi@gmail.com","sentAt":"2023-06-05T20:16:55Z","receivedAt":"2023-06-05T20:18:58Z","isPatch":true,"sender":{"key":"cheskaqiqi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109261504?v=4"},"body":"On Mon, Jun 5, 2023 at 3:16 PM Victoria Dye <vdye@github.com> wrote:\n\n> >\n> > The `p2000` tests demonstrate a ~20% execution time reduction for\n> > 'git worktree' using a sparse index:\n> >\n> > (Note:the p2000 test results did't reflect the huge speedup because of\n>\n> s/did't/didn't\n>\n> (not worth fixing if you don't end up re-rolling, though!)\n>\n> > the index reading time is minuscule comparing to the filesystem\n> > operations.)\n\nWill fix it!\n\n> >\n> > +test_expect_success 'worktree' '\n> > +     init_repos &&\n> > +\n> > +     write_script edit-contents <<-\\EOF &&\n> > +     echo text >>\"$1\"\n> > +     EOF\n> > +\n> > +     test_all_match git worktree add .worktrees/hotfix &&\n> > +     test_sparse_match ls .worktrees/hotfix &&\n>\n> I see why you're comparing 'sparse-checkout' to 'sparse-index' here (their\n> worktrees should both contain only the files matched by the sparse-checkout\n> patterns, unlike 'full-checkout' which will contain all files), but this\n> won't catch bugs that apply to both sparse-checkout and sparse-index (e.g.,\n> if the sparse checkout patterns weren't applied and the full worktrees were\n> checked out).\n>\n> To make sure that doesn't happen, you could add a section that compares each\n> test repo's default worktree to a new worktree, e.g.:\n>\n>         for repo in full-checkout sparse-checkout sparse-index\n>         do\n>                 worktree=${repo}-wt &&\n>                 git -C $repo worktree add $worktree &&\n>\n>                 # Compare worktree content with 'ls'\n>\n>                 # Compare index content with 'ls-files --sparse'\n>\n>                 # Any other comparisons that are useful\n>\n>                 git worktree remove $worktree || return 1\n>         done\n>\n\nWill do !\n\n> > +test_expect_success 'worktree is not expanded' '\n> > +     init_repos &&\n> > +\n> > +     test_all_match git worktree add .worktrees/hotfix &&\n>\n> Shouldn't 'git worktree add' not expand the index? Why use 'test_all_match'\n> instead of 'ensure_not_expanded'?\n\nHere's my perspective on why my use of \"test_all_match\" instead of\n\"ensure_not_expanded\" in \"git worktree add\":\n\nThe functions \"validate_no_submodules\" and \"check_clean_worktree\" are\nspecifically related to the \"git worktree remove\" command, and \"git\nworktree add\" doesn't require index reading, so with or without the\n\"ensure_full_index\" wouldn't affect the \"git worktree add\" command.\nI look forward to hearing your thoughts regarding whether my\nunderstanding is correct or not.\n\nThanks for your valuable feedback！\n"},{"id":"478073","messageId":"523de20d-a816-5101-af82-5bfff26fbcac@github.com","threadId":"59837","inReplyTo":"CAMO4yUEQZz8DqPb7RyN8Owb=23p==6XS6G7Bza77p4-iydo6Qg@mail.gmail.com","subject":"Re: [PATCH v1] worktree: integrate with sparse-index","fromName":"Victoria Dye","fromEmail":"vdye@github.com","sentAt":"2023-06-06T04:22:33Z","receivedAt":"2023-06-06T04:22:58Z","isPatch":true,"sender":{"key":"vdye@github.com","avatar":"https://avatars.githubusercontent.com/u/3619353?v=4"},"body":"Shuqi Liang wrote:\n>>> +test_expect_success 'worktree is not expanded' '\n>>> +     init_repos &&\n>>> +\n>>> +     test_all_match git worktree add .worktrees/hotfix &&\n>>\n>> Shouldn't 'git worktree add' not expand the index? Why use 'test_all_match'\n>> instead of 'ensure_not_expanded'?\n> \n> Here's my perspective on why my use of \"test_all_match\" instead of\n> \"ensure_not_expanded\" in \"git worktree add\":\n> \n> The functions \"validate_no_submodules\" and \"check_clean_worktree\" are\n> specifically related to the \"git worktree remove\" command, and \"git\n> worktree add\" doesn't require index reading, so with or without the\n> \"ensure_full_index\" wouldn't affect the \"git worktree add\" command.\n> I look forward to hearing your thoughts regarding whether my\n> understanding is correct or not.\n\nI see, thanks for the explanation. I could understand it both ways: on one\nhand, you don't want redundant/unnecessary tests; on the other hand, that\ntest design decision relies pretty heavily on knowing the internal\nimplementation details, which the tests conceptually shouldn't have\nvisibility to. \n\nI'd still lean towards using 'ensure_not_expanded' (it protects us from\nfuture changes causing index expansion, although that seems fairly\nunlikely). However, if you do choose to stick with not using\n'ensure_not_expanded', I'd recommend using 'git -C sparse-index worktree add\n.worktrees/hotfix' instead of 'test_all_match'. The 'worktree' test already\ncompares behavior across the three test repositories; to keep things focused\non index expansion, only the 'sparse-index' repo should be set up & tested.\n\n> \n> Thanks for your valuable feedback！\n\n"},{"id":"478106","messageId":"20230606172633.669916-1-cheskaqiqi@gmail.com","threadId":"59837","inReplyTo":"20230605161644.491424-1-cheskaqiqi@gmail.com","subject":"[PATCH v2] worktree: integrate with sparse-index","fromName":"Shuqi Liang","fromEmail":"cheskaqiqi@gmail.com","sentAt":"2023-06-06T17:26:33Z","receivedAt":"2023-06-06T17:26:53Z","isPatch":true,"sender":{"key":"cheskaqiqi@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109261504?v=4"},"body":"The index is read in 'worktree.c' at two points:\n\n1.The 'validate_no_submodules' function, which checks if there are any\nsubmodules present in the worktree.\n\n2.The 'check_clean_worktree' function, which verifies if a worktree is\n'clean', i.e., there are no untracked or modified but uncommitted files.\nThis is done by running the 'git status' command, and an error message\nis thrown if the worktree is not clean. Given that 'git status' is\nalready sparse-aware, the function is also sparse-aware.\n\nHence we can just set the requires-full-index to false for\n\"git worktree\".\n\nAdd tests that verify that 'git worktree' behaves correctly when the\nsparse index is enabled and test to ensure the index is not expanded.\n\nThe `p2000` tests demonstrate a ~20% execution time reduction for\n'git worktree' using a sparse index:\n\n(Note:the p2000 test results didn't reflect the huge speedup because of\nthe index reading time is minuscule comparing to the filesystem\noperations.)\n\nTest                                       before  after\n-----------------------------------------------------------------------\n2000.102: git worktree add....(full-v3)    3.15    2.82  -10.5%\n2000.103: git worktree add....(full-v4)    3.14    2.84  -9.6%\n2000.104: git worktree add....(sparse-v3)  2.59    2.14  -16.4%\n2000.105: git worktree add....(sparse-v4)  2.10    1.57  -25.2%\n\nHelped-by: Victoria Dye <vdye@github.com>\nSigned-off-by: Shuqi Liang <cheskaqiqi@gmail.com>\n---\n\nRange-diff against v1:\n\n* Fix did't to didn't.\n\n* Add ensure_not_expanded for \"git worktree add\".\n\n* Add a section that compares each test repo's default worktree to\na new worktree.\n\n\nRange-diff against v1:\n1:  aa772f998b ! 1:  d082c85fec worktree: integrate with sparse-index\n    @@ Commit message\n         The `p2000` tests demonstrate a ~20% execution time reduction for\n         'git worktree' using a sparse index:\n     \n    -    (Note:the p2000 test results did't reflect the huge speedup because of\n    +    (Note:the p2000 test results didn't reflect the huge speedup because of\n         the index reading time is minuscule comparing to the filesystem\n         operations.)\n     \n    @@ t/t1092-sparse-checkout-compatibility.sh: test_expect_success 'sparse index is n\n     +\techo text >>\"$1\"\n     +\tEOF\n     +\n    -+\ttest_all_match git worktree add .worktrees/hotfix &&\n    -+\ttest_sparse_match ls .worktrees/hotfix &&\n    -+\ttest_all_match git worktree remove .worktrees/hotfix &&\n    ++\tfor repo in full-checkout sparse-checkout sparse-index\n    ++\tdo\n    ++\t\tworktree=${repo}-wt &&\n    ++\t\tgit -C $repo worktree add ../$worktree &&\n    ++\n    ++\t\t# Compare worktree content with \"ls\"\n    ++\t\t(cd $repo && ls) >worktree_contents &&\n    ++\t\t(cd $worktree && ls) >new_worktree_contents &&\n    ++\t\ttest_cmp worktree_contents new_worktree_contents &&\n    ++\n    ++\t\t# Compare index content with \"ls-files --sparse\"\n    ++\t\tgit -C $repo ls-files --sparse >index_contents &&\n    ++\t\tgit -C $worktree ls-files --sparse >new_index_contents &&\n    ++\t\ttest_cmp index_contents new_index_contents &&\n    ++\n    ++\t\tgit -C $repo worktree remove ../$worktree || return 1\n    ++\tdone &&\n     +\n     +\ttest_all_match git worktree add .worktrees/hotfix &&\n     +\trun_on_all ../edit-contents .worktrees/hotfix/deep/a &&\n    @@ t/t1092-sparse-checkout-compatibility.sh: test_expect_success 'sparse index is n\n     +test_expect_success 'worktree is not expanded' '\n     +\tinit_repos &&\n     +\n    -+\ttest_all_match git worktree add .worktrees/hotfix &&\n    ++\tensure_not_expanded worktree add .worktrees/hotfix &&\n     +\tensure_not_expanded worktree remove .worktrees/hotfix\n     +'\n     +\n-- \n2.39.0\n\n\n builtin/worktree.c                       |  4 +++\n t/perf/p2000-sparse-operations.sh        |  1 +\n t/t1092-sparse-checkout-compatibility.sh | 37 ++++++++++++++++++++++++\n 3 files changed, 42 insertions(+)\n\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex f3180463be..db14bff1a3 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -1200,5 +1200,9 @@ int cmd_worktree(int ac, const char **av, const char *prefix)\n \t\tprefix = \"\";\n \n \tac = parse_options(ac, av, prefix, options, git_worktree_usage, 0);\n+\n+\tprepare_repo_settings(the_repository);\n+\tthe_repository->settings.command_requires_full_index = 0;\n+\n \treturn fn(ac, av, prefix);\n }\ndiff --git a/t/perf/p2000-sparse-operations.sh b/t/perf/p2000-sparse-operations.sh\nindex 901cc493ef..1422136c73 100755\n--- a/t/perf/p2000-sparse-operations.sh\n+++ b/t/perf/p2000-sparse-operations.sh\n@@ -131,5 +131,6 @@ test_perf_on_all git describe --dirty\n test_perf_on_all 'echo >>new && git describe --dirty'\n test_perf_on_all git diff-files\n test_perf_on_all git diff-files -- $SPARSE_CONE/a\n+test_perf_on_all \"git worktree add ../temp && git worktree remove ../temp\"\n \n test_done\ndiff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh\nindex a63d0cc222..746203d375 100755\n--- a/t/t1092-sparse-checkout-compatibility.sh\n+++ b/t/t1092-sparse-checkout-compatibility.sh\n@@ -2180,4 +2180,41 @@ test_expect_success 'sparse index is not expanded: diff-files' '\n \tensure_not_expanded diff-files -- \"deep/*\"\n '\n \n+test_expect_success 'worktree' '\n+\tinit_repos &&\n+\n+\twrite_script edit-contents <<-\\EOF &&\n+\techo text >>\"$1\"\n+\tEOF\n+\n+\tfor repo in full-checkout sparse-checkout sparse-index\n+\tdo\n+\t\tworktree=${repo}-wt &&\n+\t\tgit -C $repo worktree add ../$worktree &&\n+\n+\t\t# Compare worktree content with \"ls\"\n+\t\t(cd $repo && ls) >worktree_contents &&\n+\t\t(cd $worktree && ls) >new_worktree_contents &&\n+\t\ttest_cmp worktree_contents new_worktree_contents &&\n+\n+\t\t# Compare index content with \"ls-files --sparse\"\n+\t\tgit -C $repo ls-files --sparse >index_contents &&\n+\t\tgit -C $worktree ls-files --sparse >new_index_contents &&\n+\t\ttest_cmp index_contents new_index_contents &&\n+\n+\t\tgit -C $repo worktree remove ../$worktree || return 1\n+\tdone &&\n+\n+\ttest_all_match git worktree add .worktrees/hotfix &&\n+\trun_on_all ../edit-contents .worktrees/hotfix/deep/a &&\n+\ttest_all_match test_must_fail git worktree remove .worktrees/hotfix\n+'\n+\n+test_expect_success 'worktree is not expanded' '\n+\tinit_repos &&\n+\n+\tensure_not_expanded worktree add .worktrees/hotfix &&\n+\tensure_not_expanded worktree remove .worktrees/hotfix\n+'\n+\n test_done\n-- \n2.39.0\n\n"},{"id":"478149","messageId":"4225a82c-83cc-d81a-628d-a9a01d02acf2@github.com","threadId":"59837","inReplyTo":"20230606172633.669916-1-cheskaqiqi@gmail.com","subject":"Re: [PATCH v2] worktree: integrate with sparse-index","fromName":"Victoria Dye","fromEmail":"vdye@github.com","sentAt":"2023-06-07T17:21:22Z","receivedAt":"2023-06-07T17:21:30Z","isPatch":true,"sender":{"key":"vdye@github.com","avatar":"https://avatars.githubusercontent.com/u/3619353?v=4"},"body":"Shuqi Liang wrote:\n> Range-diff against v1:\n> \n> * Fix did't to didn't.\n> \n> * Add ensure_not_expanded for \"git worktree add\".\n> \n> * Add a section that compares each test repo's default worktree to\n> a new worktree.\n\nThanks for these updates! Everything looks good to me (especially the checks\nyou've added to the 'worktree' test).\n\n"}]}