Skip to content

pr-1488/williams-unity/sparse-doodle-v1

Hi

Back in January I submitted a patch which suggested to teach 'ls-tree' to be
able to filter its output based on sparse checkout specifications [1]. My
main motivation for doing so was (is) to enable building more tooling on top
of sparse checkouts, which is currently hampered a bit by the fact that git
doesn't expose the pattern matching rules for the sparse checkouts.

I think the main point from that thread was that the 'ls-tree' change was
conceptually a larger change that I had initially thought it was. It was
suggested that perhaps it would be more straight-forward to initially add a
command in the vein of 'git-check-ignore' before teaching all the other
commands about sparse checkout specifics, and I think that makes sense. So I
am proposing here a new 'check-rules' sub-command to 'sparse-checkout'. This
exposes the sparse checkout pattern matching logic while still keeping the
pattern specification local to the sparse-checkout command.

Since the intention is that this new behavior would not need a work tree as
it allows the user to supply a set of rules to verify the paths against, the
change that introduces the sub-command is preceded by one that removes the
'NEEDS_WORK_TREE' flag for 'sparse-checkout' and replaces it with calls to
'setup_work_tree()' to keep current behavior.

1:
https://public-inbox.org/git/pull.1459.git.1673456518993.gitgitgadget@gmail.com/

William Sprent (2):
  builtin/sparse-checkout: remove NEED_WORK_TREE flag
  builtin/sparse-checkout: add check-rules command

 Documentation/git-sparse-checkout.txt |  23 +++-
 builtin/sparse-checkout.c             | 132 +++++++++++++++++----
 git.c                                 |   2 +-
 t/t1091-sparse-checkout-builtin.sh    | 162 +++++++++++++++++++++++++-
 4 files changed, 295 insertions(+), 24 deletions(-)

base-commit: d15644fe0226af7ffc874572d968598564a230dd

Submitted-As: https://lore.kernel.org/git/pull.1488.git.1678283349.gitgitgadget@gmail.com
Assets 2