Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preliminary fix and debug information to investigate panic #2623

Merged
merged 12 commits into from Oct 27, 2023
15 changes: 14 additions & 1 deletion src/git/backend_commands.go
Expand Up @@ -126,13 +126,26 @@ func ParseVerboseBranchesOutput(output string) (domain.BranchInfos, domain.Local
lines := stringslice.Lines(output)
checkedoutBranch := domain.EmptyLocalBranchName()
for _, line := range lines {
if line == "" {
if strings.TrimSpace(line) == "" {
continue
}
parts := spaceRE.Split(line[2:], 3)
if parts[0] == "remotes/origin/HEAD" {
continue
}
if len(parts) < 2 {
// This shouldn't happen, but did happen in https://github.com/git-town/git-town/issues/2562.
fmt.Println("ERROR: Encountered irregular Git output")
fmt.Println()
fmt.Println("PLEASE REPORT THE OUTPUT BELOW AT https://github.com/git-town/git-town/issues/new")
fmt.Println()
fmt.Printf("Problematic line: %q\n", line)
fmt.Println()
fmt.Println("BEGIN OUTPUT FROM 'git branch -vva'")
fmt.Println(output)
fmt.Println("END OUTPUT FROM 'git branch -vva'")
os.Exit(1)
}
branchName := parts[0]
var sha domain.SHA
if parts[1] == "branch," {
Expand Down