pwntester / octo.nvim

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

Allow detecting repo name from rewritten URLs #228

Closed nandofarias closed 2 years ago

nandofarias commented 2 years ago

Issue Description

Type: feature request/bug report

Describe what happened (or what feature you want)

Hi folks. I have a few git global configs that rewrite URLs so I can use a shorter command like git clone github:owner/repo to clone repos. Because of the https://github.com/pwntester/octo.nvim/blob/master/lua/octo/utils.lua#L149 the returned value from git config --get remote.origin.url is github:owner/repo instead of git@github.com:owner/repothis causes an error when I try to run Octo pr list. gh: Could not resolve to a Repository with the name 'nil/nil'.

Describe what you expected to happen

One possible solution is to change the command to local cmd = string.format("git remote get-url %s", candidate) or add another else if statement that can support alias:owner/repo pattern.

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

  1. git config --global url."git@github.com:".insteadOf "github:"
  2. git clone github:pwntester/octo.nvim
  3. `nvim +"Octo pr list"

Tell us your environment

NVIM v0.7.0-dev+674-g24f9463dd-dirty MacOS Montrey 12.0.1 gh version 2.4.0 (2021-12-21)

Anything else we need to know?

Just let me know if you want a PR for that. Thank you!

pwntester commented 2 years ago

Thanks, a PR is certainly welcomed 👍🏼