Skip to content

Commit

Permalink
gx에서 github url 에 repository 에 .git suffix 가 붙은경우 처리 못하던 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
deptno committed Oct 15, 2023
1 parent 5b70bf0 commit c27ad96
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/lab/gx/lib/get_git_remote_info.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
local remove_suffix = function (suffix, name)
if name:sub(-#suffix) == suffix then
return name:sub(1, -(#suffix + 1))
end
return name
end
local get_git_remote_info = function (cwd)
local command = type(cwd) == 'string'
and string.format("git -C %s remote -v | head -1 | awk '{print $2}'", cwd)
Expand All @@ -17,8 +23,7 @@ local get_git_remote_info = function (cwd)

local domain = parts[2]
local username = parts[3]
local repository = vim.fn.fnamemodify(parts[4], ':r')

local repository = remove_suffix('.git', parts[4])

return {
domain = domain,
Expand Down

0 comments on commit c27ad96

Please sign in to comment.