Skip to content

Commit

Permalink
Preliminary fix and debug information to investigate panic (#2623)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo committed Oct 27, 2023
1 parent b5f9801 commit 43c998c
Showing 1 changed file with 14 additions and 1 deletion.
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

0 comments on commit 43c998c

Please sign in to comment.