From 337f8d0bc7fc89442f5f883dafedd930a7719418 Mon Sep 17 00:00:00 2001 From: Hashino Date: Fri, 13 Sep 2024 19:20:13 -0300 Subject: [PATCH 1/2] fix(repo finding): considers cases where git repo has a trailing / the automatic repository finding (when none passed as args) wouldn't work when the return of `git remote -v` had a trailing '/' parser would split the lines with '/' as a delimiter. the trailing '/' made the result be an array of length 4 which wasn't considered. --- lua/octo/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/octo/utils.lua b/lua/octo/utils.lua index dab52e12..57d17299 100644 --- a/lua/octo/utils.lua +++ b/lua/octo/utils.lua @@ -149,7 +149,7 @@ function M.parse_remote_url(url, aliases) -- if url contains two slashes local segments = vim.split(url, "/") local host, repo - if #segments == 3 then + if #segments == 3 or (#segments == 4 and segments[4] == '') then host = segments[1] repo = segments[2] .. "/" .. segments[3] elseif #segments == 2 then From b90bf213d774ae2783b26fc7bf2b5262bc80b711 Mon Sep 17 00:00:00 2001 From: Hashino Date: Sat, 14 Sep 2024 13:03:04 -0300 Subject: [PATCH 2/2] style(stylua): formatted changed code with stylua --- lua/octo/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/octo/utils.lua b/lua/octo/utils.lua index 57d17299..3a8b08f6 100644 --- a/lua/octo/utils.lua +++ b/lua/octo/utils.lua @@ -149,7 +149,7 @@ function M.parse_remote_url(url, aliases) -- if url contains two slashes local segments = vim.split(url, "/") local host, repo - if #segments == 3 or (#segments == 4 and segments[4] == '') then + if #segments == 3 or (#segments == 4 and segments[4] == "") then host = segments[1] repo = segments[2] .. "/" .. segments[3] elseif #segments == 2 then