Skip to content

gh pr merge panic for enterprise 2.20 #3031

@tzing

Description

@tzing

Describe the bug

gh version: 1.6.2
server: enterprise 2.20

I recently upgrade my tool from 1.5.0 to 1.6.x but fount gr pr merge would crash.
Fix in ver.1.6.1 does not help on this issue.

I couldn't find similar issue to this, will close this one if there is any duplicates.

Steps to reproduce the behavior

type gh pr merge in a branch that should have match all criteria and could be merged

$ gh pr merge
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/cli/cli/pkg/cmd/pr/merge.mergeRun(0xc00062a1b0, 0xc0002d9a40, 0x4)
        github.com/cli/cli/pkg/cmd/pr/merge/merge.go:163 +0x1c8c
github.com/cli/cli/pkg/cmd/pr/merge.NewCmdMerge.func1(0xc00047d080, 0x2013450, 0x0, 0x0, 0x0, 0x0)
        github.com/cli/cli/pkg/cmd/pr/merge/merge.go:119 +0x2bb
github.com/spf13/cobra.(*Command).execute(0xc00047d080, 0x2013450, 0x0, 0x0, 0xc00047d080, 0x2013450)
        github.com/spf13/cobra@v1.1.1/command.go:850 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0xc00042a580, 0xc0002d98e0, 0x1, 0x2)
        github.com/spf13/cobra@v1.1.1/command.go:958 +0x375
main.main()
        github.com/cli/cli/cmd/gh/main.go:150 +0xa05

Expected vs actual behavior

Expected: show prompt for choosing merge strategy
Actual: golang error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions