pwntester / octo.nvim

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

Fix broken remote detection #289

Closed choplin closed 2 years ago

choplin commented 2 years ago

Describe what this PR does / why we need it

The current implementation of utils.get_remote_name, introduced via https://github.com/pwntester/octo.nvim/commit/cd8bdcbfca4dd57b38fe25ba570a2e3f51b1f77b, returns a wrong value containing a domain name, e.g. github.com/pwntester/octo.nvim , which subsequently makes many commands not able to function properly, including Octo issue list , Octo pr list etc.

Does this pull request fix one issue?

None

Describe how you did it

Strip domain name before returning the value.

e.g. "github.com/pwntester/octo.nvim" to "pwntester/octo.nvim"

Describe how to verify it

Special notes for reviews

I'm not sure what kind of URL is expected in the ":/" or ":" separator case. Please tell me if this PR does not work properly for those cases.

pwntester commented 2 years ago

Thanks, for sending a fix. I implemented it a little diffefently in https://github.com/pwntester/octo.nvim/commit/7fbce041ac2b9f1c97208a3653cc1af3522a5acf can you please check if it works for you?

choplin commented 2 years ago

Thank you for letting me know it. But, after pulling the commit, get_remote_name returns null unexpectedly. This is probably because the remote url I tested is like ssh://git@github.com/pwntester/octo.nvim.git, which does not match any defined condition. While it valid ssh URL for git and it is able to access git hub repository via this kind of URL, GitHub document says that they support ssh URL only in the form of git@github.com:user/repo.git, so I'll leave it to you whether support ssh:// style URL.

pwntester commented 2 years ago

Got it, I added support for ssh:// remote urls too, thanks for reporting and for the PR!