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.
This commit is contained in:
1 parent
de1576af0a
commit
c09f2a1a11
1 file changed
+3
-3
@@ -106,7 +106,7 @@ def git_diff_has_changes(since, until, excludes=()):
|
|||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def locked():
|
def locked():
|
||||||
DIWAN_DIR.mkdir(exist_ok=True)
|
STATE_DIR.mkdir(exist_ok=True)
|
||||||
fd = open(LOCK_FILE, "w")
|
fd = open(LOCK_FILE, "w")
|
||||||
try:
|
try:
|
||||||
fcntl.flock(fd, fcntl.LOCK_EX)
|
fcntl.flock(fd, fcntl.LOCK_EX)
|
||||||
@@ -140,7 +140,7 @@ def load_state():
|
|||||||
|
|
||||||
|
|
||||||
def save_state(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")
|
STATE_FILE.write_text(json.dumps(state, indent=2) + "\n")
|
||||||
|
|
||||||
|
|
||||||
@@ -394,7 +394,7 @@ def cmd_bare(args):
|
|||||||
|
|
||||||
|
|
||||||
def cmd_tick(args):
|
def cmd_tick(args):
|
||||||
DIWAN_DIR.mkdir(exist_ok=True)
|
STATE_DIR.mkdir(exist_ok=True)
|
||||||
if git_is_dirty():
|
if git_is_dirty():
|
||||||
if git_commit_all("chore: snapshot manual edits before tick"):
|
if git_commit_all("chore: snapshot manual edits before tick"):
|
||||||
print("Committed pending manual edits before starting tick.")
|
print("Committed pending manual edits before starting tick.")
|
||||||
|
|||||||
Reference in new issue
Block a user