Re: [PATCH v2 10/18] sparse-checkout: use new update_sparsity() function
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Mar 23, 2020, 18:07 UTC
- Message-ID
- <45021041-eab4-6e0e-5966-11db06333ab2@gmail.com>
- In-Reply-To
- <27ed4a3f7a28c66d8185cb4c484e8b0af81b15c6.1584813609.git.gitgitgadget@gmail.com>
On 3/21/2020 2:00 PM, Elijah Newren via GitGitGadget wrote:
Show 6 quoted lines
> From: Elijah Newren <newren@gmail.com> > > Remove the equivalent of 'git read-tree -mu HEAD' in the sparse-checkout > codepaths for setting the SKIP_WORKTREE bits and instead use the new > update_sparsity() function. >
[snip]
Show 31 quoted lines
> diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh > index 8607a8e6d1a..86ae422ff5c 100755 > --- a/t/t1091-sparse-checkout-builtin.sh > +++ b/t/t1091-sparse-checkout-builtin.sh > @@ -277,16 +277,23 @@ test_expect_success 'cone mode: add parent path' ' > check_files repo a deep folder1 > ' > > -test_expect_success 'revert to old sparse-checkout on bad update' ' > +test_expect_success 'not-up-to-date does not block rest of sparsification' ' > test_when_finished git -C repo sparse-checkout disable && > test_when_finished git -C repo reset --hard && > git -C repo sparse-checkout set deep && > + > echo update >repo/deep/deeper2/a && > cp repo/.git/info/sparse-checkout expect && > - test_must_fail git -C repo sparse-checkout set deep/deeper1 2>err && > - test_i18ngrep "cannot set sparse-checkout patterns" err && > - test_cmp repo/.git/info/sparse-checkout expect && > - check_files repo/deep a deeper1 deeper2 > + test_write_lines "!/deep/*/" "/deep/deeper1/" >>expect && > + > + git -C repo sparse-checkout set deep/deeper1 2>err && > + > + test_i18ngrep "Cannot update sparse checkout" err && > + test_cmp expect repo/.git/info/sparse-checkout && > + check_files repo/deep a deeper1 deeper2 && > + check_files repo/deep/deeper1 a deepest && > + check_files repo/deep/deeper1/deepest a && > + check_files repo/deep/deeper2 a > '
This demonstrates some of the value of using update_sparsity. I expect some more specific tests are coming later in the series.
Show 25 quoted lines
> test_expect_success 'revert to old sparse-checkout on empty update' ' > @@ -316,12 +323,22 @@ test_expect_success '.gitignore should not warn about cone mode' ' > test_i18ngrep ! "disabling cone patterns" err > ' > > -test_expect_success 'sparse-checkout (init|set|disable) fails with dirty status' ' > +test_expect_success 'sparse-checkout (init|set|disable) warns with dirty status' ' > git clone repo dirty && > echo dirty >dirty/folder1/a && > - test_must_fail git -C dirty sparse-checkout init && > - test_must_fail git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* && > - test_must_fail git -C dirty sparse-checkout disable && > + > + git -C dirty sparse-checkout init 2>err && > + test_i18ngrep "error" err && > + test_i18ngrep "Cannot update sparse checkout" err && > + > + git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* && > + test_i18ngrep "error" err && > + test_i18ngrep "Cannot update sparse checkout" err && > + > + git -C dirty sparse-checkout disable && > + test_i18ngrep "error" err && > + test_i18ngrep "Cannot update sparse checkout" err && > +
Should the "error" messages we grep for be more specific? Are they the same as the "Cannot update sparse checkout"?