Skip to content

fix: fall back to dirname/unknown when git context is absent#564

Open
collinstraka-clov wants to merge 1 commit intogarrytan:mainfrom
collinstraka-clov:fix/gstack-slug-unbound-variable
Open

fix: fall back to dirname/unknown when git context is absent#564
collinstraka-clov wants to merge 1 commit intogarrytan:mainfrom
collinstraka-clov:fix/gstack-slug-unbound-variable

Conversation

@collinstraka-clov
Copy link
Copy Markdown

Problem

gstack-review-log uses set -euo pipefail, which treats empty strings as unbound variables. When run outside a git repo (or in a repo with no remote configured), gstack-slug produces empty strings for SLUG and BRANCH, causing:

gstack-review-log: line 8: SLUG: unbound variable
gstack-review-log: line 9: BRANCH: unbound variable

This breaks any gstack review skill (e.g. /autoplan, /plan-ceo-review) when the working directory isn't a git repo with a remote.

Fix

Two changes in gstack-slug:

  1. Add || true to the git commands so set -e doesn't abort when git context is missing
  2. Fall back to basename "$PWD" for SLUG and "unknown" for BRANCH when the values are empty

Repro

Run any gstack review skill in a directory with no git remote configured.

🤖 Generated with Claude Code

gstack-review-log uses set -euo pipefail, which treats empty strings as
unbound variables. When run outside a git repo (or in a repo with no
remote), gstack-slug produced empty SLUG and BRANCH, causing:

  gstack-review-log: line 8: SLUG: unbound variable
  gstack-review-log: line 9: BRANCH: unbound variable

Fix: add || true to prevent set -e from aborting on git failures, then
fall back to the current directory name for SLUG and "unknown" for BRANCH.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant