Skip to content

Commit 0879d04

Browse files
authored
fix(task-management): support git worktrees in router root detection (#301)
find_project_root used [ -d "$dir/.git" ], which fails in a git worktree where .git is a file containing a gitdir: pointer rather than a directory. Switches to -e (a strict superset, so the normal-repo case is unaffected; submodules are fixed for free). Also changes return 1 to return 0 in the fallback branch: PROJECT_ROOT="$(find_project_root)" takes the command substitution's exit status, so under set -e the script aborted after the fallback value had already been computed, producing silent no-output. Mainly affects non-Node projects consuming OAC from a worktree; this repo's root package.json masks the bug.
1 parent cde3efe commit 0879d04

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.opencode/skills/task-management/router.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ find_project_root() {
7272
local dir
7373
dir="$(pwd)"
7474
while [ "$dir" != "/" ]; do
75-
if [ -d "$dir/.git" ] || [ -f "$dir/package.json" ]; then
75+
if [ -e "$dir/.git" ] || [ -f "$dir/package.json" ]; then
7676
echo "$dir"
7777
return 0
7878
fi
7979
dir="$(dirname "$dir")"
8080
done
8181
pwd
82-
return 1
82+
return 0
8383
}
8484

8585
# Handle help

0 commit comments

Comments
 (0)