Repository navigation
nebel add: encrypt already-tracked files immediately - #6
Merged
Merged
Conversation
`add file`/`add field` only wrote the rule and .gitattributes line. If a matching file was already tracked and unchanged in the working tree, git kept trusting its cached stat info and never re-invoked the clean filter, so the file stayed plaintext in the repository indefinitely — contradicting the documented "no further step" promise, and silently so until `nebel status` was run. Both subcommands now renormalize (git add --renormalize equivalent) any currently tracked file that config.MatchRule resolves to the rule just written, reporting what got encrypted and warning that already-committed history is unaffected. Scoped to nebel's own rule matching rather than a raw pathspec, so a brand-new glob matching nothing yet isn't an error. gitutil gains Renormalize (RenormalizeAll's scoped sibling) and TrackedFiles, both using `git ls-files -z`/`-s -z` so a non-ASCII filename (which git quotes as a C-style escaped string by default) doesn't silently fall out of scope. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 tasks done
MuffinUser
added a commit
that referenced
this pull request
Sep 29, 2026
Re-merge PR #6 onto main (encrypt already-tracked files on add)
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
add file/add fieldused to only write the rule and.gitattributesline. If a matching file was already tracked and unchanged in the working tree, git kept trusting its cached stat info and never re-invoked the clean filter — the file stayed plaintext in the repository indefinitely, contradicting USER_INTERACTIONS.md's documented "no further step" promise.git add --renormalizeequivalent) any currently tracked file thatconfig.MatchRuleresolves to the rule just written, print what got encrypted, and warn that already-committed history is unaffected (change the underlying secret if the repo's been pushed). A brand-new glob matching nothing yet is not an error.gitutilgainsRenormalize(a scoped sibling ofRenormalizeAll) andTrackedFiles, both usinggit ls-files -z/-s -zso a non-ASCII filename (which git quotes as a C-style escaped string by default) doesn't silently fall out of scope.Test plan
cmd/nebel/add_existing_files_test.gocover:add fileon an already-tracked settled file,add filewith a glob matching no tracked files (must not error),add fieldon an already-tracked settled file, appending a field to an existing rule on an already-tracked file, and a non-ASCII filename.go build ./...,go vet ./...,go test ./... -count=1all pass.