Commit aa1ba53
authored
fix: strip git name-rev suffix operators from detected branch name (#189)
In detached-HEAD CI checkouts (common in Buildkite/CircleCI/Jenkins/etc.
where none of the GitHub/GitLab/Bitbucket CI env vars are recognized),
the Python CLI falls back to `git name-rev --name-only HEAD` to detect
the current branch. When the checked-out SHA is not exactly at a branch
tip (e.g. master moved forward after the pipeline started), name-rev
returns strings like `remotes/origin/master~1` or `master^0`. The
previous split('/')[-1] cleanup kept the `~N`/`^N` suffix, which the
Socket API then rejected with "Invalid branch name".
Strip anything from the first `~` or `^` onward before the prefix
split. Both characters are forbidden in git ref names per
check-ref-format(1), so truncating at them is always safe.
Assisted-by: Claude Code:opus-4-71 parent 2bbe390 commit aa1ba53
File tree
4 files changed
+12
-2
lines changed- socketsecurity
- core
4 files changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
0 commit comments