pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.37k stars 127 forks source link

Octo pr reload breaks when going through Octo shorthand #426

Closed exosyphon closed 11 months ago

exosyphon commented 12 months ago

Issue Description

Type: bug report

Describe what happened (or what feature you want)

When trying to reload a PR after opening it through the :Octo prompt I receive an error

E5108: Error executing lua vim/shared.lua:0: s: expected string, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'gsplit'
        vim/shared.lua: in function 'split'
        ...drew/.local/share/nvim/lazy/octo.nvim/lua/octo/utils.lua:638: in function 'split_repo'
        ...ndrew/.local/share/nvim/lazy/octo.nvim/lua/octo/init.lua:87: in function 'load'
        ...ndrew/.local/share/nvim/lazy/octo.nvim/lua/octo/init.lua:81: in function 'load_buffer'
        ...w/.local/share/nvim/lazy/octo.nvim/lua/octo/commands.lua:1283: in function 'reload'
        ...w/.local/share/nvim/lazy/octo.nvim/lua/octo/commands.lua:129: in function 'fun'
        ...m/lazy/octo.nvim/lua/octo/pickers/telescope/provider.lua:993: in function 'run_replace_or_original'
        ...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'select_default'
        /Users/andrew/.config/nvim/after/plugin/telescope.lua:39: in function 'key_func'
        ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

Describe what you expected to happen

I expect the PR to be reloaded in the buffer without errors

How to reproduce it (as minimally and precisely as possible)

  1. :Octo
  2. select "pr list"
  3. select a PR
  4. :Octo pr reload either from command OR from :Octo and then choosing "pr reload"

Tell us your environment

MacOS NVIM v0.9.2 Build type: Release LuaJIT 2.1.0-beta3 "octo.nvim": { "branch": "master", "commit": "22a231fc621346734464c3cbca0be467b292b343" },

Anything else we need to know?

If I use the :Octo pr list command instead of :Octo flow then it works as expected

pwntester commented 12 months ago

Hi, I can reproduce this on my side. Is this a public PR I can take a look? Can you try doing :e! instead of Octo pr reload? Do you get the same error when not using the enable_builtin feature (using :Octo pr list instead of Octo and then selecting pr list)?

exosyphon commented 11 months ago

Unfortunately it's not a public PR but I think I reproduced it with a couple repos. I'll confirm that and try :e!

If I use the :Octo pr list command instead of :Octo flow then it works as expected

exosyphon commented 11 months ago

I tested today whether :e! resolved the issue and it did not. I tried recreating this today with the latest gh cli and now it merges a PR if I select it from the pr list menu 😨

pwntester commented 11 months ago

I tried recreating this today with the latest gh cli and now it merges a PR if I select it from the pr list menu 😨

Sorry about that, it was a bug introduced by a very recent PR. Reported and fixed here

I tested today whether :e! resolved the issue and it did not

I just merged another fix related with the buffer reloading. Not sure if it will fix this problem but worth trying with the latest version

kezhenxu94 commented 11 months ago

@pwntester Looks like you linked to the wrong pull request πŸ˜„ , it should be https://github.com/pwntester/octo.nvim/pull/435 that fixed this issue.

BTW I saw exactly the same error before #435 merged

pwntester commented 11 months ago

Ouch πŸ˜“ thanks for the heads up and fix!

exosyphon commented 11 months ago

I tested with another branch today and everything works as expected with NVIM 0.9.4 and commit e933611.

Thanks again for all the updates!