-
-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip-worktree support, sparse checkout impl #1495
base: master
Are you sure you want to change the base?
Conversation
Previously, IndexEntry did not store or expose the extended_flags field, causing any skip-worktree bits to be discarded when reading or writing the index. This patch adds flags and extended_flags fields to IndexEntry, and updates from_serialized/serialize to preserve them. In particular: - We store both flags and extended_flags from SerializedIndexEntry. - We clear/set stage bits in flags, preserving the rest (including the extended flag). - We introduce a helper method set_skip_worktree() to enable or disable the skip-worktree bit in extended_flags, and set/unset FLAG_EXTENDED as needed. With these changes, Dulwich can now retain and manipulate skip-worktree bits when reading and writing .git/index, enabling sparse checkout functionality to match Git’s behavior.
…ktree property read the extended flags bit
Removed the cone mode TDDs (doesn't make sense to introduce them prematurely) and ran the same tests the CI runs (I thought it was just make check
python -m mypy dulwich
python -m ruff check .
python -m ruff format check . Should go green now 🤞 |
Thanks for working on this - overall looks great, but some minor comments inline and one larger one about placement of the code in porcelain.py. |
Thanks for reviewing! Yes would be great to land this and extend to further steps. Apologies for the roughness, did not mean to include a uv lockfile, and yes I meant to remove those codenames. Will revise and resubmit shortly |
…tvals and side effects
Ready for re-review @jelmer 😎 |
Changes look good; please take a look at the ruff failures |
This PR adds and refines functionality around sparse checkout, including:
IndexEntry
, preservingextended_flags
so that excluded files actually stay out of the working tree.write_index
so that index entries with extended flags are written as version 3 or higher.test_porcelain.py
for cone-mode sparse checkout (currently skipped, as cone mode is not fully implemented yet, but the tests are in place for future development). I did my best but I decided to submit now and not potentially spoil it. (I can take these out but I am confident I'll be able to do cone mode with a bit more thought)test_index.py
sparse_checkout
function, so we can raise or force-remove on excluded paths.All tests now pass (aside from the intentionally skipped cone-mode ones). I ran
make check
and hope this can land.