-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance open_online action #25
Conversation
lua/telescope/_extensions/packer.lua
Outdated
local function get_url(path) | ||
local url = vim.fn.trim(vim.fn.system(string.format("git -C %s ls-remote --get-url", path))) | ||
if string.sub(url, 1, 6) == 'ssh://' then | ||
url, _ = string.gsub(url, [[^ssh://[^/]+/]], 'https://github.com/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not every ssh://
points to github.com, we can actually get the real url from that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. if we have
local url = "ssh://[email protected]:gitlab-org/gitlab.git"
url = string.gsub(url, [[^ssh://[^/]+/]], 'https://github.com/')
print(url)
i would expect https://gitlab.com/gitlab-org/gitlab
but i currently get https://github.com/gitlab.git
which is completely wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
I'll fix it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
if string.sub(url, 1, 6) == 'ssh://' then | ||
url, _ = string.gsub(url, '^ssh://%w+@', 'https://') | ||
url, _ = string.gsub(url, '^ssh://', 'https://') | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh one more thing it could also start with [email protected]:nvim-telescope/telescope.nvim.git
e.g.
This pull-request will resolve:
open_online
action does not support ssh:// remote url. (open_online action does not work #21)open_online
action does not support WSL. ("Open online repository" never works in the WSL #24)@Conni2461 Review and merge it plz.