Skip to content

Commit 3621007

Browse files
author
endolinbot
committed
journal-worktree-keeper: rebuild a genuinely ABSENT journal/ checkout instead of skipping forever
jw_repair_gitdir began with '[ -d $jw ] || return 0', declaring a deleted journal/ dir healthy — the rebuild-from-origin fallback its own comments promise for exactly this case was unreachable, and the keeper WARN-skipped 'missing or unlinked … skipping' every tick indefinitely. A missing dir now routes straight to jw_rebuild_dangling_worktree, whose existing hard guards (canonical-path-only, owning-repo-with-origin, no-writer probe skipped when the dir is absent) already cover the absent-dir shape. journal-worktree-keeper-test + journal-worktree-relink-test: pass.
1 parent 36e1477 commit 3621007

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

scripts/jobs/journal-worktree-keeper.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,17 @@ heal_diverged_worktree() { # heal_diverged_worktree <jw> <ahead> <behind> <dirt
303303
# untouched).
304304
jw_repair_gitdir() { # jw_repair_gitdir <jw>
305305
local jw="$1"
306-
[ -d "$jw" ] || return 0
306+
# A GENUINELY ABSENT worktree dir goes straight to the rebuild: the old
307+
# `[ -d "$jw" ] || return 0` short-circuit declared a deleted journal/ checkout
308+
# "healthy", so the rebuild machinery below was unreachable and the keeper
309+
# WARN-skipped ("missing or unlinked … skipping") every tick forever — exactly
310+
# the case jw_rebuild_dangling_worktree's own guards were written to handle
311+
# (its active-writer probe explicitly skips when the dir is missing, and its
312+
# hard guard confines the rebuild to the canonical $GARDEN_ROOT/journal path).
313+
if [ ! -d "$jw" ]; then
314+
jw_rebuild_dangling_worktree "$jw"
315+
return
316+
fi
307317
# STEP 1 — the shared, non-destructive prune-first repair (common.sh). Returns 0
308318
# when the gitdir re-links (stale sibling registrations pruned first); 1 when even
309319
# that could not restore the linkage because the owning admin entry is gone.

0 commit comments

Comments
 (0)