Closed
Conversation
Contributor
eslerm
commented
Mar 20, 2026
- Replace hardcoded branch prefix with branch_prefix config field
- Falls back to git config user.name, then no prefix
Prevent indefinite hangs when GitHub is slow or unreachable by setting a 30s timeout on the OAuth2 HTTP client and all exec.CommandContext calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace hardcoded "mgreau/" branch prefix with branch_prefix config field. Falls back to git config user.name, then no prefix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
642cab3 to
8f16aaa
Compare
mgreau
reviewed
Mar 20, 2026
Owner
mgreau
left a comment
There was a problem hiding this comment.
Two related issues on the git config user.name fallback in GetBranchPrefix.
Comment on lines
+138
to
+141
| // Try git config | ||
| out, err := exec.Command("git", "config", "user.name").Output() | ||
| if err == nil { | ||
| name := strings.TrimSpace(string(out)) |
Owner
There was a problem hiding this comment.
Two issues here:
-
exec.Commandhas no timeout. Every other subprocess in this codebase now useswithTimeout/exec.CommandContext. This call can hang indefinitely if git is slow or the working directory is unusual. -
user.namecan contain spaces (e.g."John Doe"), producing branch names likeJohn Doe/featurethat break many tools and CLIs.
Suggestion fixes both — wraps the call in a 5s context and replaces spaces with hyphens. Also needs "context" added to the import block.
Suggested change
| // Try git config | |
| out, err := exec.Command("git", "config", "user.name").Output() | |
| if err == nil { | |
| name := strings.TrimSpace(string(out)) | |
| // Try git config user.name; replace spaces so the prefix is branch-safe. | |
| ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) | |
| defer cancel() | |
| out, err := exec.CommandContext(ctx, "git", "config", "user.name").Output() | |
| if err == nil { | |
| name := strings.ReplaceAll(strings.TrimSpace(string(out)), " ", "-") |
Owner
|
Superseded by #7, which incorporates the review feedback (5s timeout on git config call, spaces→hyphens in user.name). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.