From c09f2a1a11fe32812306bc6524350e59b3ac232d Mon Sep 17 00:00:00 2001 From: marc Date: Mon, 9 Nov 2026 16:20:34 +0100 Subject: [PATCH] fix: STATE_DIR.mkdir leftover calls still said DIWAN_DIR Three mkdir(exist_ok=True) calls (locked(), save_state(), cmd_tick()) were never updated during the DIWAN_DIR/DIWAN_NOTES_DIR rename -- they called .mkdir() on DIWAN_DIR (the tool's own install dir, which already exists, so this silently no-op'd) instead of STATE_DIR (the content repo's .diwan/ bookkeeping dir, which needs creating on a repo's first run). Masked in all my own testing because diwan-dev-notes already had a .diwan/ directory from manual setup predating the rename; surfaced on thingvellir against a genuinely fresh content repo with no pre-existing .diwan/, where it crashed with FileNotFoundError on .diwan/.lock. Reproduced the crash against a fresh git-init'd repo with no .diwan/ directory, confirmed the fix via 'nix build' + running the packaged binary against it. --- diwan | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diwan b/diwan index e7afa6d..f6a3f85 100755 --- a/diwan +++ b/diwan @@ -106,7 +106,7 @@ def git_diff_has_changes(since, until, excludes=()): @contextlib.contextmanager def locked(): - DIWAN_DIR.mkdir(exist_ok=True) + STATE_DIR.mkdir(exist_ok=True) fd = open(LOCK_FILE, "w") try: fcntl.flock(fd, fcntl.LOCK_EX) @@ -140,7 +140,7 @@ def load_state(): def save_state(state): - DIWAN_DIR.mkdir(exist_ok=True) + STATE_DIR.mkdir(exist_ok=True) STATE_FILE.write_text(json.dumps(state, indent=2) + "\n") @@ -394,7 +394,7 @@ def cmd_bare(args): def cmd_tick(args): - DIWAN_DIR.mkdir(exist_ok=True) + STATE_DIR.mkdir(exist_ok=True) if git_is_dirty(): if git_commit_all("chore: snapshot manual edits before tick"): print("Committed pending manual edits before starting tick.")