Skip to content

Commit

Permalink
Correct invalid SSH URL
Browse files Browse the repository at this point in the history
An SSH URL with a path uses a colon between the host and the path:

	git@github.com:JuliaLang/Example.jl (correct)
	git@github.com/JuliaLang/Example.jl (incorrect)

(cherry picked from commit 749d099)
ref #18066
  • Loading branch information
omus authored and tkelman committed Aug 20, 2016
1 parent 95acc0f commit a48ce16
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/libgit2-online.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
#########
# init & clone
mktempdir() do dir
repo_url = "github.com/JuliaLang/Example.jl"
https_prefix = "https://"
ssh_prefix = "git@"
repo_url_https = "https://github.com/JuliaLang/Example.jl"
repo_url_git = "git@github.com:JuliaLang/Example.jl"
#@testset "Cloning repository" begin
#@testset "with 'https' protocol" begin
repo_path = joinpath(dir, "Example1")
repo = LibGit2.clone(https_prefix*repo_url, repo_path)
repo = LibGit2.clone(repo_url_https, repo_path)
try
@test isdir(repo_path)
@test isdir(joinpath(repo_path, ".git"))
Expand All @@ -27,7 +26,7 @@ mktempdir() do dir
repo_path = joinpath(dir, "Example2")
# credentials are required because github tries to authenticate on unknown repo
cred = LibGit2.UserPasswordCredentials("","") # empty credentials cause authentication error
LibGit2.clone(https_prefix*repo_url*randstring(10), repo_path, payload=Nullable(cred))
LibGit2.clone(repo_url_https*randstring(10), repo_path, payload=Nullable(cred))
error("unexpected")
catch ex
@test isa(ex, LibGit2.Error.GitError)
Expand All @@ -37,12 +36,13 @@ mktempdir() do dir

#TODO: remove or condition on libgit2 features this test when ssh protocol will be supported
#@testset "with 'ssh' protocol (by default is not supported)" begin
repo_path = joinpath(dir, "Example3")
repo = LibGit2.clone(repo_url_git, repo_path)
try
repo_path = joinpath(dir, "Example3")
@test_throws LibGit2.Error.GitError LibGit2.clone(ssh_prefix*repo_url, repo_path)
catch ex
# but we cloned succesfully, so check that repo was created
ex.fail == 1 && @test isdir(joinpath(path, ".git"))
@test isdir(repo_path)
@test isdir(joinpath(repo_path, ".git"))
finally
finalize(repo)
end
#end
#end
Expand Down

0 comments on commit a48ce16

Please sign in to comment.