Skip to content

Commit 93cef2e

Browse files
iamaeroplaneclaude
andcommitted
fix: check .specify before termination in find_specify_root
Fixes edge case where project root is at filesystem root (common in containers). The loop now checks for .specify before checking the termination condition. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8a9ce68 commit 93cef2e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/bash/common.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ find_specify_root() {
88
# Normalize to absolute path to prevent infinite loop with relative paths
99
dir="$(cd "$dir" 2>/dev/null && pwd)" || return 1
1010
local prev_dir=""
11-
while [ "$dir" != "/" ] && [ "$dir" != "$prev_dir" ]; do
11+
while true; do
1212
if [ -d "$dir/.specify" ]; then
1313
echo "$dir"
1414
return 0
1515
fi
16+
# Stop if we've reached filesystem root or dirname stops changing
17+
if [ "$dir" = "/" ] || [ "$dir" = "$prev_dir" ]; then
18+
break
19+
fi
1620
prev_dir="$dir"
1721
dir="$(dirname "$dir")"
1822
done

0 commit comments

Comments
 (0)