perf/index-first-lookups #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "perf/index-first-lookups"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
create_note() checked the registry entry and the write mode, then resolved a checkout path and wrote — without checking that the checkout exists. NoteRepository.write_new does mkdir(parents=True), so `zettel new` against a never-synced repo created a plain directory that is not a git repository, wrote the note into it, and reported success. The damage compounds: the next sync sees checkout_path.exists() is now true, so _clone_or_pull takes the *pull* branch, git fails in a non-repo, and the shortname reports `inaccessible` on every subsequent sync — permanently, until someone removes the directory by hand. The note is outside version control, never indexed, and never mentioned again. Refusing up front (RepoNotCheckedOutError) is the only outcome that does not silently lose the note. The guard tests `<checkout>/.git` with .exists() rather than .is_dir(), because a linked worktree stores .git as a file and writing a note into a worktree is legitimate. note_path() already took this posture ("the repo has no local checkout yet" is one of its documented None cases); the two are now consistent. Wired into both surfaces that create notes — `zettel new` and the TUI's new-note modal — alongside the NotWritableRepoError they already handle. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RW72LM22NGTeioFwzFud8X