Skip to content

push-refs: a quoted PR title with parentheses blocks the PR-create call #1258

Done

Description

@tieubao

lib/gate/push-refs.sh refuses a gh pr create call whose --title contains parentheses, even when the parentheses sit inside quotes. Conventional-commit titles such as feat(wrap): ... therefore cannot open a PR in one call.

Repro

Command: bash lib/gate/push-refs.sh "$PWD" 'gh pr create --base master --title "feat(wrap): one-call gather" --body-file /tmp/b.md' <branch> master
Output:
@@BLOCK a push must be the only command in the call (allowed beside it: 2>&1 or >/dev/null, and one pipe into tail, head, cat or grep)

Command: bash lib/gate/push-refs.sh "$PWD" 'gh pr create --base master --title "feat wrap" --body-file /tmp/b.md' <branch> master
Output:
@@REF <sha> <branch>

Cause

The one-command rule (lib/gate/push-refs.sh around line 346) sets one_ok=0 when segment 0's raw text holds any ( or ):

case "${segText[0]:-}" in *'$'*|*'`'*|*'('*|*')'*) one_ok=0 ;; esac

The rule targets command substitution ($(...)) and subshells, but it matches the raw text, so a literal parenthesis inside a quoted title counts too.

Workaround

Open the PR with a plain title, then rename it with gh pr edit <n> --title "feat(scope): ...".

Fix direction (needs a maintainer call)

This narrows a fail-closed guard, so a maintainer should decide it rather than a worker. One option: test the (/) case against the segment with quoted spans removed, and keep $ and backtick checks on the raw text (they already catch $(...) inside quotes). Add a test that a quoted feat(x): title passes and that ( git push ) and "$(git push)" still block.

Found while shipping #1257.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions