]> git.ipfire.org Git - thirdparty/git.git/commit
sparse-checkout: enable `set` to initialize sparse-checkout mode
authorElijah Newren <newren@gmail.com>
Tue, 14 Dec 2021 04:09:08 +0000 (04:09 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Dec 2021 19:48:22 +0000 (11:48 -0800)
commitf2e3a218e80fc3fd357afe65c9a26b9a90a9f5f7
tree1d20efc91ea2129bd26bdc6e703dae238abed286
parentbe61fd1181f62dcb7b6a5f41021e7f086d7c30b0
sparse-checkout: enable `set` to initialize sparse-checkout mode

The previously suggested workflow:
  git sparse-checkout init ...
  git sparse-checkout set ...

Suffered from three problems:
  1) It would delete nearly all files in the first step, then
     restore them in the second.  That was poor performance and
     forced unnecessary rebuilds.
  2) The two-step process resulted in two progress bars, which
     was suboptimal from a UI point of view for wrappers that
     invoked both of these commands but only exposed a single
     command to their end users.
  3) With cone mode, the first step would delete nearly all
     ignored files everywhere, because everything was considered
     to be outside of the specified sparsity paths.  (The user was
     not allowed to specify any sparsity paths in the `init` step.)

Avoid these problems by teaching `set` to understand the extra
parameters that `init` takes and performing any necessary initialization
if not already in a sparse checkout.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Victoria Dye <vdye@github.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/sparse-checkout.c