From c9e3af855ab4db2736872f869419f7387aac0855 Mon Sep 17 00:00:00 2001 From: meleu <8508804+meleu@users.noreply.github.com> Date: Thu, 10 Sep 2026 13:13:07 -0300 Subject: [PATCH] 'fix(gitbrowse): dont prepend a second scheme to plain http remotes closes #2954 --- lua/snacks/gitbrowse.lua | 2 +- tests/gitbrowse_spec.lua | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/snacks/gitbrowse.lua b/lua/snacks/gitbrowse.lua index 22bc1e57c..d5ba29aa8 100644 --- a/lua/snacks/gitbrowse.lua +++ b/lua/snacks/gitbrowse.lua @@ -93,7 +93,7 @@ function M.get_repo(remote, opts) for _, pattern in ipairs(opts.remote_patterns) do ret = ret:gsub(pattern[1], pattern[2]) --[[@as string]] end - return ret:find("https://") == 1 and ret or ("https://%s"):format(ret) + return ret:find("https?://") == 1 and ret or ("https://%s"):format(ret) end ---@param repo string diff --git a/tests/gitbrowse_spec.lua b/tests/gitbrowse_spec.lua index 6aeeaf5a4..f2b4ae1fe 100644 --- a/tests/gitbrowse_spec.lua +++ b/tests/gitbrowse_spec.lua @@ -30,6 +30,8 @@ local git_remotes_cases = { ["https://git.sr.ht/~user/repo"] = "https://git.sr.ht/~user/repo", ["git@git.sr.ht:~user/another-repo"] = "https://git.sr.ht/~user/another-repo", ["https://git.sr.ht/~user/another-repo"] = "https://git.sr.ht/~user/another-repo", + ["http://git.example.com/group/subgroup/repo.git"] = "http://git.example.com/group/subgroup/repo", + ["http://git.example.com/group/subgroup/repo"] = "http://git.example.com/group/subgroup/repo", } describe("util.lazygit", function()