Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lua/gitlinker/commons/json.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ M.encode = function(t)
if t == nil then
return nil
end
return require("gitlinker.commons._json").encode(t)
if vim.json ~= nil and vim.is_callable(vim.json.encode) then
return vim.json.encode(t)
else
return require("gitlinker.commons._json").encode(t)
end
end

--- @param j string?
Expand All @@ -15,7 +19,11 @@ M.decode = function(j)
if j == nil then
return nil
end
return require("gitlinker.commons._json").decode(j)
if vim.json ~= nil and vim.is_callable(vim.json.decode) then
return vim.json.decode(j)
else
return require("gitlinker.commons._json").decode(j)
end
end

return M
221 changes: 0 additions & 221 deletions lua/gitlinker/commons/ringbuf.lua

This file was deleted.

12 changes: 10 additions & 2 deletions lua/gitlinker/commons/uri.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ M.encode = function(value, rfc)
if type(value) ~= "string" then
return nil
end
return require("gitlinker.commons._uri").uri_encode(value, rfc)
if vim.is_callable(vim.uri_encode) then
return vim.uri_encode(value, rfc)
else
return require("gitlinker.commons._uri").uri_encode(value, rfc)
end
end

---@param value string?
Expand All @@ -16,7 +20,11 @@ M.decode = function(value)
if type(value) ~= "string" then
return nil
end
return require("gitlinker.commons._uri").uri_decode(value)
if vim.is_callable(vim.uri_decode) then
return vim.uri_decode(value)
else
return require("gitlinker.commons._uri").uri_decode(value)
end
end

return M
2 changes: 1 addition & 1 deletion lua/gitlinker/commons/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.0.0
15.0.0
3 changes: 2 additions & 1 deletion lua/gitlinker/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ local _run_cmd = async.wrap(function(args, cwd, callback)
end
end,
}, function()
logger:debug(string.format("|_run_cmd| result:%s", vim.inspect(result)))
callback(result)
end)
end, 3)
Expand Down Expand Up @@ -366,7 +367,7 @@ local function get_branch_remote(cwd)
return nil
end

if #remotes == 1 then
if #remotes >= 1 then
return remotes[1]
end

Expand Down