]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'en/sparse-checkout-fixes'
authorJunio C Hamano <gitster@pobox.com>
Mon, 7 Mar 2022 05:25:30 +0000 (21:25 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Mar 2022 05:25:30 +0000 (21:25 -0800)
Further polishing of "git sparse-checkout".

* en/sparse-checkout-fixes:
  sparse-checkout: reject arguments in cone-mode that look like patterns
  sparse-checkout: error or warn when given individual files
  sparse-checkout: pay attention to prefix for {set, add}
  sparse-checkout: correctly set non-cone mode when expected
  sparse-checkout: correct reapply's handling of options

1  2 
builtin/sparse-checkout.c
t/t1091-sparse-checkout-builtin.sh

Simple merge
index 502d42d183a098a9fbb07e5bb1dfca4915d05958,421127d99c2c6c4e28043a92d0258eaff1a167fa..9a900310186d3876f873d5da5ff94dca4a3da35c
@@@ -510,6 -495,34 +510,37 @@@ test_expect_failure 'sparse-checkout re
        git -C tweak sparse-checkout disable
  '
  
+ test_expect_success 'reapply can handle config options' '
+       git -C repo sparse-checkout init --cone --no-sparse-index &&
+       git -C repo config --worktree --list >actual &&
+       cat >expect <<-\EOF &&
+       core.sparsecheckout=true
+       core.sparsecheckoutcone=true
++      index.sparse=false
+       EOF
+       test_cmp expect actual &&
+       git -C repo sparse-checkout reapply --no-cone --no-sparse-index &&
+       git -C repo config --worktree --list >actual &&
+       cat >expect <<-\EOF &&
+       core.sparsecheckout=true
++      core.sparsecheckoutcone=false
++      index.sparse=false
+       EOF
+       test_cmp expect actual &&
+       git -C repo sparse-checkout reapply --cone --sparse-index &&
+       git -C repo config --worktree --list >actual &&
+       cat >expect <<-\EOF &&
+       core.sparsecheckout=true
+       core.sparsecheckoutcone=true
+       index.sparse=true
+       EOF
+       test_cmp expect actual &&
+       git -C repo sparse-checkout disable
+ '
  test_expect_success 'cone mode: set with core.ignoreCase=true' '
        rm repo/.git/info/sparse-checkout &&
        git -C repo sparse-checkout init --cone &&