Hi, On Wed, Mar 8, 2023 at 5:49 AM William Sprent via GitGitGadget <gitgitgadget@xxxxxxxxx> wrote: > > 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@xxxxxxxxx/ Sorry for the delay in reviewing. Patch 1 looks good to me. Patch 2 looks really good as well, but there were a few minor things that we might be able to touch up. And now that I've played with it and tested a little bit locally, I really like the idea of having this functionality around. Thanks for sending it in. > 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 > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1488%2Fwilliams-unity%2Fsparse-doodle-v1 > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1488/williams-unity/sparse-doodle-v1 > Pull-Request: https://github.com/gitgitgadget/git/pull/1488 > -- > gitgitgadget