On Mon, Oct 21, 2019 at 01:56:19PM +0000, Derrick Stolee via GitGitGadget wrote: > From: Derrick Stolee <dstolee@xxxxxxxxxxxxx> > > 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. > 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. > + 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 >