aviator-co / av

A command line tool to manage stacked PRs with Aviator
https://aviator.co
MIT License
258 stars 19 forks source link

av pr create gets oom error when empty branch in stack #449

Open msmanek-dd opened 1 week ago

msmanek-dd commented 1 week ago

I have the following branch setup:

    * msmanek-criteria-10                         
    │                                             
    * msmanek-criteria-05                         
    │                                             
    │ * msmanek-criteria-03                       
    ├─┘                                           
    * msmanek-criteria-00                         
    │                                             
    * master                                      

Criteria 00, 05, and 10 all have commits and associated PRs. Criteria 03 does not.

When I try and stack sync with github, it get's the following error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104fcc750]

goroutine 1 [running]:
github.com/aviator-co/av/internal/actions.UpdatePullRequestWithStack({0x105729ae8, 0x105d4fb00}, 0x1400047f170, {0x10572e2d8, 0x1400049a8c0}, {0x14000038ae0, 0x13})
        /home/runner/work/av/av/internal/actions/pr.go:900 +0xd0
github.com/aviator-co/av/internal/actions.UpdatePullRequestsWithStack({0x105729ae8, 0x105d4fb00}, 0x1400047f170, {0x10572e2d8, 0x1400049a8c0}, {0x14000252180?, 0x1?, 0x105729ae8?})
        /home/runner/work/av/av/internal/actions/pr.go:942 +0x78
main.init.func13(0x105cfec80, {0x105d4fb00?, 0x4?, 0x10521bfab?})
        /home/runner/work/av/av/cmd/av/pr_create.go:114 +0x49c
github.com/spf13/cobra.(*Command).execute(0x105cfec80, {0x105d4fb00, 0x0, 0x0})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0x834
github.com/spf13/cobra.(*Command).ExecuteC(0x105cfd860)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
main.main()
        /home/runner/work/av/av/cmd/av/main.go:110 +0x3c

Thankfully it at least pushes my PR to github. But, the nice handy comment on the top that shows the stack does not show up.

This is remedied by deleting criteria 03 branch locally and then running av stack tidy (PS: how does orphan work?)

Would love a fix though :)

msmanek-dd commented 4 days ago

@jainankit -> now this one is a real bug that i think needs to be fixed

jainankit commented 3 hours ago

Thanks for reporting the issue. Seems like the issue with an empty branch, we will take a look.