Skip to content

Commit f6dbbe2

Browse files
committed
fix: restrict spec conflict check to directories only
compgen -G matches files and directories; a file like specs/001-notes.md would false-positive the guardrail. Now iterates matches and checks -d to ensure only directories trigger a conflict.
1 parent 8f7472f commit f6dbbe2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scripts/bash/create-new-feature.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,14 @@ FEATURE_NUM=$(printf "%03d" "$((10#$BRANCH_NUMBER))")
275275
# Reuses check_existing_branches, which fetches remotes and checks both
276276
# specs directories and all local/remote branches.
277277
if [ "$NUMBER_EXPLICIT" = true ]; then
278-
# Check for conflict in spec directories
278+
# Check for conflict in spec directories (directories only)
279279
SPEC_CONFLICT=false
280-
if compgen -G "$SPECS_DIR/${FEATURE_NUM}-*" > /dev/null 2>&1; then
281-
SPEC_CONFLICT=true
282-
fi
280+
while IFS= read -r spec_path; do
281+
if [ -d "$spec_path" ]; then
282+
SPEC_CONFLICT=true
283+
break
284+
fi
285+
done < <(compgen -G "$SPECS_DIR/${FEATURE_NUM}-*" 2>/dev/null)
283286

284287
# Check for conflict in git branches (local and remote)
285288
BRANCH_CONFLICT=false

0 commit comments

Comments
 (0)