From 5225aa9b314711e54c32ef5fd44ef3350dc201f8 Mon Sep 17 00:00:00 2001 From: arthur Date: Sun, 14 Jul 2024 14:02:01 +0800 Subject: [PATCH] update comment --- lua/lazyvim/util/lazygit.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/lazyvim/util/lazygit.lua b/lua/lazyvim/util/lazygit.lua index d468e9f7..a278899f 100644 --- a/lua/lazyvim/util/lazygit.lua +++ b/lua/lazyvim/util/lazygit.lua @@ -186,10 +186,9 @@ function M.get_url(remote) --- @param url string local function getRemoteURLFromSSH(url) - local transformedUrl = "" local SSHConfigPath = vim.env.HOME .. "/.ssh/config" - -- Return the original URL if SSH config is not found or not readable + -- Returns if SSH config is not found or not readable if not vim.uv.fs_access(SSHConfigPath, "R") then return end @@ -197,11 +196,12 @@ function M.get_url(remote) -- Handle SSH config remotes local file = io.open(SSHConfigPath, "r") - -- Return the original URL if unable to read SSH config file + -- Returns if unable to read SSH config file if not file then return end + local transformedUrl = "" local currentHost, hostGroup = "", {} for line in file:lines() do line = line:match("^%s*(.-)%s*$") @@ -218,6 +218,7 @@ function M.get_url(remote) transformedUrl = url:gsub(searchString, destinationURL):gsub("%.git$", "") break end + -- Setup group of host currentHost = value hostGroup[currentHost] = {}