Skip to content

Sparse-checkout: Add subcommand and Windows paths

Derrick Stolee via GitGitGadget git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4sparse-checkout: extract add_patterns_from_input()builtin/sparse-checkout.c+35 -291 reply
2/4sparse-checkout: extract pattern update from 'set' subcommandbuiltin/sparse-checkout.c+26 -180 replies
3/4sparse-checkout: create 'add' subcommandDocumentation/git-sparse-checkout.txt builtin/sparse-checkout.c t/t1091-sparse-checkout-builtin.sh+132 -61 reply
4/4sparse-checkout: work with Windows pathsbuiltin/sparse-checkout.c t/t1091-sparse-checkout-builtin.sh+17 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] Sparse-checkout: Add subcommand and Windows paths

This is based on ds/sparse-checkout-harden.

The sparse-checkout builtin currently lets users modify their sparse-checkout file with the all-or-nothing "set" subcommand. It may be easier for a user to expand their sparse cone using a "git sparse-checkout add <pattern/path> ..." subcommand. To achieve this while reusing as much code as possible from the "set" subcommand, the first two patches extract methods from sparse_checkout_set().

As part of this "add" subcommand, I created a modify_pattern_list() method that serves as the core interaction with the sparse-checkout file and working directory. It changes how it constructs the in-memory pattern list based on an "enum modify_type" that only has two options: REPLACE and ADD. This could be extended with REMOVE in a later update. I started building the REMOVE logic, but it was more complicated than ADD, and I didn't have time to finish it right now due to other obligations.

Finally, a Windows user contacted me about using Windows-style paths when in cone mode to add a nested directory. This case is fixed and tested in the final patch.

Thanks, -Stolee

Derrick Stolee (4):
sparse-checkout: extract add_patterns_from_input()
sparse-checkout: extract pattern update from 'set' subcommand
sparse-checkout: create 'add' subcommand
sparse-checkout: work with Windows paths

 Documentation/git-sparse-checkout.txt |   7 ++
 builtin/sparse-checkout.c             | 141 ++++++++++++++++++++------
 t/t1091-sparse-checkout-builtin.sh    |  73 +++++++++++++
 3 files changed, 189 insertions(+), 32 deletions(-)

base-commit: f998a3f1e588d73ed7285cb14ac4839f63f6dc82
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-546%2Fderrickstolee%2Fsparse-add-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-546/derrickstolee/sparse-add-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/546

Signature · 1 line
gitgitgadget