Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Enhance open_online action #25

wants to merge 4 commits into from

Conversation

kyoh86
Copy link

@kyoh86 kyoh86 commented Nov 20, 2022

This pull-request will resolve:

@Conni2461 Review and merge it plz.

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/')
Copy link
Member

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

Copy link
Member

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

Copy link
Author

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@kyoh86 kyoh86 requested a review from Conni2461 January 9, 2023 05:45
Comment on lines +50 to +53
if string.sub(url, 1, 6) == 'ssh://' then
url, _ = string.gsub(url, '^ssh://%w+@', 'https://')
url, _ = string.gsub(url, '^ssh://', 'https://')
end
Copy link
Member

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.

@kyoh86 kyoh86 closed this Jul 26, 2023
@kyoh86 kyoh86 deleted the enh-open-online-action branch July 26, 2023 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants