refactor: migrate intent_add_untracked to git2, setting INTENT_TO_ADD flag without shelling out#310
Closed
Scott McMaster (scottmcmaster) wants to merge 4 commits into
Conversation
This was referenced Jun 4, 2026
Closed
Collaborator
Author
3 tasks
intent_add_untracked to git2, setting INTENT_TO_ADD flag without shelling out
Copilot started reviewing on behalf of
Scott McMaster (scottmcmaster)
June 4, 2026 02:24
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors intent_add_untracked (used to make untracked config files visible to Nix flake evaluation) to use git2 instead of shelling out to the Git CLI, and expands unit test coverage for the new behavior.
Changes:
- Replaced CLI-based discovery (
git ls-files --others) and intent staging (git add -N) with agit2implementation that setsINTENT_TO_ADDindex entries pointing at the empty blob. - Added unit tests verifying the
INTENT_TO_ADDflag behavior, ignored-file filtering, and support for repos without a HEAD commit. - Minor formatting cleanups in existing tests.
Closed
3 tasks
Contributor
📋 PR Overview
🔬 Coverage
|
dc8d1d2 to
526f541
Compare
2678915 to
6014387
Compare
cooper (czxtm)
approved these changes
Jun 4, 2026
Contributor
Merge activity
|
…ilesystem metadata, avoid overblobbing the index
25a56f9 to
9ae849a
Compare
8ea959e to
67f8cda
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Port
intent_add_untrackedfrom CLI to git2, with comments noting a few minor complexities.Test Plan
Existing unit tests (of which there were some) passed, also added a couple new tests, and did manual testing with things like "add a new .nix file to my configuration" and verify that it passes build check and build.
Docs
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.