sshaw / git-link

Emacs package to get the GitHub/Bitbucket/GitLab/... URL for a buffer location
394 stars 73 forks source link

Fails to resolve insteadOf directives when looking up remote URLs #111

Closed ilmari closed 1 year ago

ilmari commented 1 year ago

Given my ~/.gitconfig has:

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

and I do git clone gh:sshaw/git-link, open git-link/git-link.el and run M-x git-link, I get the error message No handler found for gh

This is because git-link--remote-url calls git config remote.{name}.url which returns the raw URL. Instead it should be calling git remote get-url {name}, which resolves insteadOf directives.

This version works for me:

(defun git-link--remote-url (name)
  (car (git-link--exec "remote" "get-url" name)))
sshaw commented 1 year ago

Thanks @ilmari. This has been fixed on master. Check it out!