Skip to content

Re-merge PR #6 onto main (encrypt already-tracked files on add) - #10

Merged
MuffinUser merged 1 commit into
mainfrom
reintegrate-add-existing-files
Sep 29, 2026
Merged

MuffinUser merged 1 commit into
mainfrom
reintegrate-add-existing-files

Conversation

@MuffinUser

Copy link
Copy Markdown
Owner

Summary

PR #6 ("nebel add: encrypt already-tracked files immediately") shows as merged on GitHub, but its actual commit is not reachable from current main — main was reset to an earlier point after that merge, silently dropping it while GitHub kept the "merged" badge. This PR re-applies that same commit (8e1d550) on top of current main, which now also includes the six mitigation-plan fixes from PR #5 and #7.

Cherry-picked cleanly with no conflicts, verified by hand since it touches two files those PRs also changed (cmd/nebel/add.go, internal/gitutil/gitutil.go):

  • add.go: the P07 glob-escaping fix (escapeGitattributesPattern) is untouched; PR nebel add: encrypt already-tracked files immediately #6's new filesMatchingNewRule/renormalizeAndReport correctly layers on top, and was in fact already written with the P07 finding in mind (uses cfg.MatchRule rather than a raw pathspec).
  • gitutil.go: the P01 dirty-check (DirtyFiles/ErrDirtyManagedFiles/CheckoutAll) is untouched; PR nebel add: encrypt already-tracked files immediately #6's new Renormalize/TrackedFiles sit alongside it, and ManagedFiles now reuses TrackedFiles.

Test plan

🤖 Generated with Claude Code

`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>
@MuffinUser
MuffinUser merged commit 15413e3 into main Sep 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant