ejoffe / spr

Stacked Pull Requests on GitHub
MIT License
711 stars 65 forks source link

spr runtime error with new githubHost (GitHub Enterprise) #402

Open jonathanloske opened 2 months ago

jonathanloske commented 2 months ago

We just moved our repository from one host to another. Subsequently, I updated .spr.yml to point to the new repo. Unfortunately, spr is very unhappy with this:

❯ git spr status           
> git rev-parse --show-toplevel
> github fetch pull requests
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x101059478]

goroutine 1 [running]:
github.com/ejoffe/spr/github/githubclient.(*client).GetInfo(0x140000a2a38, {0x1012444f0?, 0x101561500?}, {0x101244410, 0x140000a2a20})
        /Users/runner/work/spr/spr/github/githubclient/client.go:200 +0x138
github.com/ejoffe/spr/spr.(*stackediff).StatusPullRequests(0x140000acfc0, {0x1012444f0, 0x101561500})
        /Users/runner/work/spr/spr/spr/spr.go:349 +0x74
main.main.func2(0x14000218d80?)
        /Users/runner/work/spr/spr/cmd/spr/main.go:134 +0x28
github.com/urfave/cli/v2.(*Command).Run(0x14000218d80, 0x140000af440)
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.8.1/command.go:169 +0x4f8
github.com/urfave/cli/v2.(*App).RunContext(0x14000083860, {0x1012444f0?, 0x101561500}, {0x140000ba000, 0x2, 0x2})
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.8.1/app.go:341 +0x85c
github.com/urfave/cli/v2.(*App).Run(...)
        /Users/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.8.1/app.go:247
main.main()
        /Users/runner/work/spr/spr/cmd/spr/main.go:230 +0x1208

This can be reproduced by having set a custom githubHost and then updating it to github.com.

jonathanloske commented 1 month ago

I am still having this error. It might also have to do with the instance I'm connecting to. It shouldn't be about the version, though: The old instance we connected to had version GitHub Enterprise Server 3.8.13, while the new one has version GitHub Enterprise Server 3.9.10.

This is the line that is referenced in the error message: https://github.com/ejoffe/spr/blob/e2eb7866cef98536e1b58e18d55cdaa298bc6762/github/githubclient/client.go#L200

The content is repoID = resp.Repository.Id. This is the first time the code accesses information about the repository, maybe it is about that. Please let me know if I can provide any further info. I tried using --detail but it resulted in the same output as above.

jonathanloske commented 1 month ago

Also of note: This happens even for newly cloned repositories. In the beginning, I thought it was only about repositories in which I had changed githubHost.