mirror of
https://github.com/TimUntersberger/neogit
synced 2024-09-16 14:24:09 +02:00
Merge branch 'nightly' of github.com:NeogitOrg/neogit into nightly
This commit is contained in:
commit
c2619a33ee
2 changed files with 30 additions and 2 deletions
|
@ -83,7 +83,7 @@ function M.parse(url)
|
|||
if protocol == "git" then
|
||||
user = "git"
|
||||
host = url:match([[@([^:]+)]])
|
||||
owner = url:match([[:(%w+)/]])
|
||||
owner = url:match([[:([^/]+)/]])
|
||||
else
|
||||
user = url:match([[://(%w+):?%w*@]]) -- Strip passwords.
|
||||
port = url:match([[:(%d+)]])
|
||||
|
@ -102,7 +102,7 @@ function M.parse(url)
|
|||
owner = path -- Strictly for backwards compatibility.
|
||||
end
|
||||
|
||||
repository = url:match([[/(%w+)%.git]])
|
||||
repository = url:match([[/([^/]+)%.git]])
|
||||
end
|
||||
|
||||
return {
|
||||
|
|
|
@ -133,5 +133,33 @@ describe("lib.git.remote", function()
|
|||
url = "https://gitlab.priv:4443/project/path/repo.git",
|
||||
})
|
||||
end)
|
||||
|
||||
it("can parse 'git@github.com:owner-with-dashes/repo.git'", function()
|
||||
local url = "git@github.com:owner-with-dashes/repo.git"
|
||||
|
||||
assert.are.same(git.remote.parse(url), {
|
||||
host = "github.com",
|
||||
owner = "owner-with-dashes",
|
||||
protocol = "git",
|
||||
repo = "repo",
|
||||
repository = "repo",
|
||||
url = "git@github.com:owner-with-dashes/repo.git",
|
||||
user = "git",
|
||||
})
|
||||
end)
|
||||
|
||||
it("can parse 'git@github.com:owner/repo-with_specials.git'", function()
|
||||
local url = "git@github.com:owner/repo-with_specials.git"
|
||||
|
||||
assert.are.same(git.remote.parse(url), {
|
||||
host = "github.com",
|
||||
owner = "owner",
|
||||
protocol = "git",
|
||||
repo = "repo-with_specials",
|
||||
repository = "repo-with_specials",
|
||||
url = "git@github.com:owner/repo-with_specials.git",
|
||||
user = "git",
|
||||
})
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue