From 6bac8ef85a302206ed980677abf72797d0dc5786 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Wed, 25 Sep 2024 22:29:22 +0300 Subject: [PATCH] feat(lazygit): `util.lazygit.browse` can open current branch --- lua/lazyvim/util/lazygit.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/lazygit.lua b/lua/lazyvim/util/lazygit.lua index ff96c85c..3d7b80bb 100644 --- a/lua/lazyvim/util/lazygit.lua +++ b/lua/lazyvim/util/lazygit.lua @@ -189,6 +189,7 @@ end function M.browse() local lines = require("lazy.manage.process").exec({ "git", "remote", "-v" }) local remotes = {} ---@type {name:string, url:string}[] + local branch = require("lazy.manage.process").exec({ "git", "rev-parse", "--abbrev-ref", "HEAD" })[1] for _, line in ipairs(lines) do local name, remote = line:match("(%S+)%s+(%S+)%s+%(fetch%)") @@ -197,7 +198,7 @@ function M.browse() if url then table.insert(remotes, { name = name, - url = url, + url = (branch ~= "main" and branch ~= "master") and url .. "/tree/" .. branch or url, }) end end