Re: [PATCH v5 10/17] sparse-checkout: init and set in cone mode
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Nov 19, 2019, 17:50 UTC
- Message-ID
- <20191119175046.GK23183@szeder.dev>
- In-Reply-To
- <0258ee80265f5f27a7de9b81eaf166648b4511d4.1571666187.git.gitgitgadget@gmail.com>
On Mon, Oct 21, 2019 at 01:56:19PM +0000, Derrick Stolee via GitGitGadget wrote:
Show 7 quoted lines
> From: Derrick Stolee <dstolee@microsoft.com> > > To make the cone pattern set easy to use, update the behavior of > 'git sparse-checkout [init|set]'. > > Add '--cone' flag to 'git sparse-checkout init' to set the config > option 'core.sparseCheckoutCone=true'.
It's not necessary to run 'git sparse-checkout init' before running 'git sparse-checkout set'. The description of the latter in the documentation is not explicit about it, but the commit message adding the 'set' subcommand is, and there are several test cases that run 'set' without a preceeding 'init.
Therefore, I think the 'set' subcommand should get a '--cone' option as well.
Show 17 quoted lines
> diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh > index 9907278fc1..ae99803d40 100755 > --- a/t/t1091-sparse-checkout-builtin.sh > +++ b/t/t1091-sparse-checkout-builtin.sh > @@ -186,4 +186,55 @@ test_expect_success 'sparse-checkout disable' ' > test_cmp expect dir > ' > > +test_expect_success 'cone mode: init and set' ' > + git -C repo sparse-checkout init --cone && > + git -C repo config --list >config && > + test_i18ngrep "core.sparsecheckoutcone=true" config && > + ls repo >dir && > + echo a >expect && > + test_cmp expect dir && > + git -C repo sparse-checkout set deep/deeper1/deepest/ 2>err && > + test_line_count = 0 err &&
'test_must_be_empty err' would be more idiomatic here as well.
Show 46 quoted lines
> + ls repo >dir && > + cat >expect <<-EOF && > + a > + deep > + EOF > + test_cmp expect dir && > + ls repo/deep >dir && > + cat >expect <<-EOF && > + a > + deeper1 > + EOF > + test_cmp expect dir && > + ls repo/deep/deeper1 >dir && > + cat >expect <<-EOF && > + a > + deepest > + EOF > + test_cmp expect dir && > + cat >expect <<-EOF && > + /* > + !/*/ > + /deep/ > + !/deep/*/ > + /deep/deeper1/ > + !/deep/deeper1/*/ > + /deep/deeper1/deepest/ > + EOF > + test_cmp expect repo/.git/info/sparse-checkout && > + git -C repo sparse-checkout set --stdin 2>err <<-EOF && > + folder1 > + folder2 > + EOF > + test_line_count = 0 err && > + cat >expect <<-EOF && > + a > + folder1 > + folder2 > + EOF > + ls repo >dir && > + test_cmp expect dir > +' > + > test_done > -- > gitgitgadget >