ejoffe / spr

Stacked Pull Requests on GitHub
MIT License
796 stars 68 forks source link

[git spr status] fails with an error #331

Closed shawnpanda closed 8 months ago

shawnpanda commented 1 year ago

Running git spr status keeps returning an error. I have tried resetting Github credentials, reinstalling spr and nothing worked.

Environment: linux version: 0.13.0 (installed via brew)

My .spr.yaml file in the repo:

githubRepoOwner: XYZ
githubRepoName: ABC
githubHost: github.com
requireChecks: true
requireApproval: true
githubRemote: origin
githubBranch: master
remoteBranches: []
mergeMethod: squash

error stacktrace:

> git spr status
error: unable to fetch remote branch info, using defaults> git rev-parse --show-toplevel
> github fetch pull requests
panic: Something went wrong while executing your query. This may be the result of a timeout, or it could be a GitHub bug. Please include `A9EA:62EB:28B2534:2A11403:6479481B` when reporting this issue.

goroutine 1 [running]:
github.com/ejoffe/spr/github/githubclient.check({0x923420, 0xc00000c468})
        /Users/runner/work/spr/spr/github/githubclient/client.go:652 +0xfa
github.com/ejoffe/spr/github/githubclient.(*client).GetInfo(0xc00000c5d0, {0x92d7f0, 0xc0000a8000}, {0x92d978, 0xc00000c588})
        /Users/runner/work/spr/spr/github/githubclient/client.go:183 +0xe5
github.com/ejoffe/spr/spr.(*stackediff).StatusPullRequests(0xc000074c00, {0x92d7f0, 0xc0000a8000})
        /Users/runner/work/spr/spr/spr/spr.go:334 +0x70
main.main.func2(0xc0001dc1c0)
        /Users/runner/work/spr/spr/cmd/spr/main.go:128 +0x25
github.com/urfave/cli/v2.(*Command).Run(0xc0001d2480, 0xc00003a700)
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/command.go:163 +0x64a
github.com/urfave/cli/v2.(*App).RunContext(0xc000001ba0, {0x92d7f0, 0xc0000a8000}, {0xc0000ba000, 0x2, 0x2})
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:313 +0x81e
github.com/urfave/cli/v2.(*App).Run(...)
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.3.0/app.go:224
main.main()
        /Users/runner/work/spr/spr/cmd/spr/main.go:224 +0x1325
ejoffe commented 1 year ago

This might be related to the new way of fetching the remote origin and branch name. I'll add some debug logs and hopefully you can recreate this issue and we can get to the bottom of it.

ejoffe commented 8 months ago

This should work ok as long as either the gitHubBranch configuration is set correctly or the upstream of the local git branch is set.