pwntester / octo.nvim

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

Autocmd errors when opening `octo://*` buffers #466

Closed scottschroeder closed 9 months ago

scottschroeder commented 9 months ago

Issue Description

Type: bug report

Describe what happened (or what feature you want)

When opening any octo://* path, I'd see

Error detected while processing BufReadCmd Autocommands for "octo://*":  

here is a specific example

:Octo pr edit 97
Error executing Lua callback: vim/_editor.lua:0: nvim_exec2()..BufReadCmd Autocommands for "octo://*": Vim(append):
stack traceback:
        [C]: in function 'nvim_exec2'
        vim/_editor.lua: in function 'cmd'
        ...ager/.local/share/nvim/lazy/octo.nvim/lua/octo/utils.lua:581: in function 'get_pull_request'
        ...r/.local/share/nvim/lazy/octo.nvim/lua/octo/commands.lua:71: in function 'a'
        ...r/.local/share/nvim/lazy/octo.nvim/lua/octo/commands.lua:377: in function 'octo'
        ...r/.local/share/nvim/lazy/octo.nvim/lua/octo/commands.lua:18: in function <...r/.local/share/nvim/lazy/octo.nvim/lua/octo/commands.lua:17>
Press ENTER or type command to continue

Investigation

It looks like the match statement for extracting the username does not match output gh.

https://github.com/pwntester/octo.nvim/blob/4a60f50bb886572a59fde095b990fa28e2b50dba/lua/octo/gh/init.lua#L59-L60

where the output from gh

❯ gh auth status --hostname github.com
github.com
  ✓ Logged in to github.com account scottschroeder (keyring)
- "Logged in to [^%s]+ as ([^%s]+)"
+ "Logged in to [^%s]+ account ([^%s]+)"

Tell us your environment

octo commit 4a60f50bb886572a59fde095b990fa28e2b50dba (master)

❯ gh --version
gh version 2.40.1 (2023-12-13)
https://github.com/cli/cli/releases/tag/v2.40.1
❯ nvim --version
NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1692716794

Anything else we need to know?

joshmedeski commented 9 months ago

Thanks! The work around is valid until the relate PR is merged 👍