Skip to content

Commit

Permalink
fix: update git impl matches new shell.execute behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
TwIStOy committed Jul 22, 2024
1 parent 400618a commit e552778
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lua/gx/git.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
M = {}

local function parse_git_output(result)
if not result or #result < 1 then
if not result or #result < 0 then
return
end

local domain, repository = result[1]:gsub("%.git%s*$", ""):match("@(.*%..*):(.*)$")
result = vim.trim(result)
local domain, repository = result:gsub("%.git%s*$", ""):match("@(.*%..*):(.*)$")
if domain and repository then
return "https://" .. domain .. "/" .. repository
end

local url = result[1]:gsub("%.git%s*$", ""):match("^https?://.+")
local url = result:gsub("%.git%s*$", ""):match("^https?://.+")
if url then
return url
end
Expand Down
1 change: 1 addition & 0 deletions lua/gx/shell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local shell = {}

function shell.execute(command, args, options)
local cmd = { command, unpack(args) }
options = options or {}
local opts = vim.tbl_extend("force", {}, options)

local obj = vim.system(cmd, opts):wait()
Expand Down

0 comments on commit e552778

Please sign in to comment.