f-person / git-blame.nvim

Git Blame plugin for Neovim written in Lua
GNU General Public License v3.0
838 stars 41 forks source link

Get remote url with `git remote get-url` #135

Open sarmong opened 2 weeks ago

sarmong commented 2 weeks ago

Current implementation uses git config --get remote.origin.url which is problematic when there is an insteadOf in git config.

E.g. I have this:

[url "git@github.com:"]
  insteadOf = "gh:"

So, git config --get remote.origin.url returns gh:user/repo and thus fails to open in a URL. Whereas git remote get-url origin will return HTTP or SSH url, that can be then used.

f-person commented 2 weeks ago

Hi, yeah this makes sense. Maybe we could convert such behaviors into configurable ones via some strategy enums? I think there was a similar case a while ago that would benefit from this approach

sarmong commented 2 weeks ago

I am not sure what would be the usecase of using url from config instead of remote get-url. For example gitlinker.nvim does it this way and I haven't seen any issues raised there.