From: Victoria Dye <vdye@github.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Victoria Dye via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, newren@gmail.com, gitster@pobox.com,
Derrick Stolee <derrickstolee@github.com>
Subject: Re: [PATCH v2 3/7] read-tree: expand sparse checkout test coverage
Date: Mon, 28 Feb 2022 15:27:00 -0800 [thread overview]
Message-ID: <509e860c-5bda-b92f-96c5-39f9a54f1e9b@github.com> (raw)
In-Reply-To: <220301.861qzm37qt.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason wrote:
>
> On Thu, Feb 24 2022, Victoria Dye via GitGitGadget wrote:
>
>> From: Victoria Dye <vdye@github.com>
>>
>> Add tests focused on how 'git read-tree' behaves in sparse checkouts. Extra
>> emphasis is placed on interactions with files outside the sparse cone, e.g.
>> merges with out-of-cone conflicts.
>>
>> Signed-off-by: Victoria Dye <vdye@github.com>
>> ---
>> t/perf/p2000-sparse-operations.sh | 1 +
>> t/t1092-sparse-checkout-compatibility.sh | 85 ++++++++++++++++++++++++
>> 2 files changed, 86 insertions(+)
>>
>> diff --git a/t/perf/p2000-sparse-operations.sh b/t/perf/p2000-sparse-operations.sh
>> index 2a7106b9495..382716cfca9 100755
>> --- a/t/perf/p2000-sparse-operations.sh
>> +++ b/t/perf/p2000-sparse-operations.sh
>> @@ -117,6 +117,7 @@ test_perf_on_all git diff
>> test_perf_on_all git diff --cached
>> test_perf_on_all git blame $SPARSE_CONE/a
>> test_perf_on_all git blame $SPARSE_CONE/f3/a
>> +test_perf_on_all git read-tree -mu HEAD
>> test_perf_on_all git checkout-index -f --all
>> test_perf_on_all git update-index --add --remove $SPARSE_CONE/a
>>
>> diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
>> index b1dcaa0e642..9d58da4e925 100755
>> --- a/t/t1092-sparse-checkout-compatibility.sh
>> +++ b/t/t1092-sparse-checkout-compatibility.sh
>> @@ -819,6 +819,91 @@ test_expect_success 'update-index --cacheinfo' '
>> test_cmp expect sparse-checkout-out
>> '
>>
>> +test_expect_success 'read-tree --merge with files outside sparse definition' '
>> + init_repos &&
>> +
>> + test_all_match git checkout -b test-branch update-folder1 &&
>> + for MERGE_TREES in "base HEAD update-folder2" \
>> + "update-folder1 update-folder2" \
>> + "update-folder2"
>> + do
>> + # Clean up and remove on-disk files
>> + test_all_match git reset --hard HEAD &&
>> + test_sparse_match git sparse-checkout reapply &&
>> +
>> + # Although the index matches, without --no-sparse-checkout, outside-of-
>> + # definition files will not exist on disk for sparse checkouts
>> + test_all_match git read-tree -mu $MERGE_TREES &&
>> + test_all_match git status --porcelain=v2 &&
>> + test_path_is_missing sparse-checkout/folder2 &&
>> + test_path_is_missing sparse-index/folder2 &&
>> +
>> + test_all_match git read-tree --reset -u HEAD &&
>> + test_all_match git status --porcelain=v2 &&
>> +
>> + test_all_match git read-tree -mu --no-sparse-checkout $MERGE_TREES &&
>> + test_all_match git status --porcelain=v2 &&
>> + test_cmp sparse-checkout/folder2/a sparse-index/folder2/a &&
>> + test_cmp sparse-checkout/folder2/a full-checkout/folder2/a || return 1
>> + done
>> +'
>
> Nit: Isn't this nicer/easier by unrolling the for-loop to the top-level, i.e.:
>
> for MERGE_TREES in "base HEAD update-folder2" [...]
> do
> test_expect_success "'read-tree -mu $MERGE_TREES' with files outside sparse definition" '
> init_repos &&
> test_when_finished "test_all_match git reset --hard HEAD" &&
> ...
> '
> done
>
> It makes failures easier to reason about since you see which for-loop
> iteration you're in right away, and can e.g. pick one with --run.
>
I like how this separates the test cases (while not adding any
redundant/copied code). I'll update in the next version, thanks!
> And we can do the cleanup in test_when_finished instead of at the start
> of every loop.
Because `init_repos` completely resets the test repos, this actually lets me
remove the extra cleanup steps completely.
next prev parent reply other threads:[~2022-02-28 23:27 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 18:25 [PATCH 0/7] Sparse index: integrate with 'read-tree' Victoria Dye via GitGitGadget
2022-02-23 18:25 ` [PATCH 1/7] sparse-index: prevent repo root from becoming sparse Victoria Dye via GitGitGadget
2022-02-24 16:48 ` Derrick Stolee
2022-02-24 21:42 ` Victoria Dye
2022-02-23 18:25 ` [PATCH 2/7] status: fix nested sparse directory diff in sparse index Victoria Dye via GitGitGadget
2022-02-23 18:25 ` [PATCH 3/7] read-tree: expand sparse checkout test coverage Victoria Dye via GitGitGadget
2022-02-23 18:25 ` [PATCH 4/7] read-tree: integrate with sparse index Victoria Dye via GitGitGadget
2022-02-23 18:25 ` [PATCH 5/7] read-tree: narrow scope of index expansion for '--prefix' Victoria Dye via GitGitGadget
2022-02-23 18:25 ` [PATCH 6/7] read-tree: make two-way merge sparse-aware Victoria Dye via GitGitGadget
2022-02-26 8:05 ` Elijah Newren
2022-02-28 18:04 ` Victoria Dye
2022-03-01 2:56 ` Elijah Newren
2022-02-23 18:25 ` [PATCH 7/7] read-tree: make three-way " Victoria Dye via GitGitGadget
2022-02-24 16:59 ` [PATCH 0/7] Sparse index: integrate with 'read-tree' Derrick Stolee
2022-02-24 22:34 ` [PATCH v2 " Victoria Dye via GitGitGadget
2022-02-24 22:34 ` [PATCH v2 1/7] sparse-index: prevent repo root from becoming sparse Victoria Dye via GitGitGadget
2022-02-24 22:34 ` [PATCH v2 2/7] status: fix nested sparse directory diff in sparse index Victoria Dye via GitGitGadget
2022-02-25 7:45 ` Elijah Newren
2022-02-28 23:17 ` Victoria Dye
2022-02-24 22:34 ` [PATCH v2 3/7] read-tree: expand sparse checkout test coverage Victoria Dye via GitGitGadget
2022-02-26 8:41 ` Elijah Newren
2022-02-28 18:14 ` Victoria Dye
2022-02-28 23:09 ` Ævar Arnfjörð Bjarmason
2022-02-28 23:27 ` Victoria Dye [this message]
2022-02-28 23:46 ` Ævar Arnfjörð Bjarmason
2022-02-24 22:34 ` [PATCH v2 4/7] read-tree: integrate with sparse index Victoria Dye via GitGitGadget
2022-02-24 22:34 ` [PATCH v2 5/7] read-tree: narrow scope of index expansion for '--prefix' Victoria Dye via GitGitGadget
2022-02-25 8:38 ` Elijah Newren
2022-02-25 20:25 ` Victoria Dye
2022-02-26 7:52 ` Elijah Newren
2022-02-28 18:44 ` Victoria Dye
2022-02-24 22:34 ` [PATCH v2 6/7] read-tree: make two-way merge sparse-aware Victoria Dye via GitGitGadget
2022-02-24 22:34 ` [PATCH v2 7/7] read-tree: make three-way " Victoria Dye via GitGitGadget
2022-02-26 8:46 ` [PATCH v2 0/7] Sparse index: integrate with 'read-tree' Elijah Newren
2022-03-01 20:24 ` [PATCH v3 0/8] " Victoria Dye via GitGitGadget
2022-03-01 20:24 ` [PATCH v3 1/8] sparse-index: prevent repo root from becoming sparse Victoria Dye via GitGitGadget
2022-03-01 20:24 ` [PATCH v3 2/8] status: fix nested sparse directory diff in sparse index Victoria Dye via GitGitGadget
2022-03-01 20:24 ` [PATCH v3 3/8] read-tree: explicitly disallow prefixes with a leading '/' Victoria Dye via GitGitGadget
2022-03-01 20:24 ` [PATCH v3 4/8] read-tree: expand sparse checkout test coverage Victoria Dye via GitGitGadget
2022-03-01 20:24 ` [PATCH v3 5/8] read-tree: integrate with sparse index Victoria Dye via GitGitGadget
2022-03-01 20:24 ` [PATCH v3 6/8] read-tree: narrow scope of index expansion for '--prefix' Victoria Dye via GitGitGadget
2022-03-03 17:54 ` Glen Choo
2022-03-03 21:19 ` Victoria Dye
2022-03-04 18:47 ` Glen Choo
2022-03-01 20:24 ` [PATCH v3 7/8] read-tree: make two-way merge sparse-aware Victoria Dye via GitGitGadget
2022-03-01 20:24 ` [PATCH v3 8/8] read-tree: make three-way " Victoria Dye via GitGitGadget
2022-03-02 7:22 ` [PATCH v3 0/8] Sparse index: integrate with 'read-tree' Elijah Newren
2022-03-02 13:40 ` Derrick Stolee
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=509e860c-5bda-b92f-96c5-39f9a54f1e9b@github.com \
--to=vdye@github.com \
--cc=avarab@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=newren@gmail.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).