-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit d3b54bbf690c4707a52b9eaec31f24701fb7e6c7) (cherry picked from commit c46d13e30f4d32daea3eb9a9b28091afcadd7446) (cherry picked from commit 1b0926a)
- Loading branch information
1 parent
285fc25
commit 464182e
Showing
2 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,8 +75,13 @@ setprotocol!(proto::Union{Nothing, AbstractString}=nothing) = GIT_PROTOCOL[] = p | |
# TODO: extend this to more urls | ||
function normalize_url(url::AbstractString) | ||
m = match(GITHUB_REGEX, url) | ||
(m === nothing || GIT_PROTOCOL[] === nothing) ? | ||
url : "$(GIT_PROTOCOL[])://github.com/$(m.captures[1]).git" | ||
if m === nothing || GIT_PROTOCOL[] === nothing | ||
url | ||
elseif GIT_PROTOCOL[] == "ssh" | ||
"ssh://[email protected]/$(m.captures[1]).git" | ||
else | ||
"$(GIT_PROTOCOL[])://github.com/$(m.captures[1]).git" | ||
end | ||
end | ||
|
||
function clone(url, source_path; header=nothing, kwargs...) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,6 +256,23 @@ temp_pkg_dir() do project_path | |
end | ||
end | ||
end | ||
mktempdir() do devdir | ||
withenv("JULIA_PKG_DEVDIR" => devdir) do | ||
try | ||
https_url = "https://github.com/JuliaLang/Example.jl.git" | ||
ssh_url = "ssh://[email protected]/JuliaLang/Example.jl.git" | ||
@test Pkg.GitTools.normalize_url(https_url) == https_url | ||
Pkg.setprotocol!("ssh") | ||
@test Pkg.GitTools.normalize_url(https_url) == ssh_url | ||
# TODO: figure out how to test this without | ||
# having to deploy a ssh key on github | ||
#Pkg.develop("Example") | ||
#@test isinstalled(TEST_PKG) | ||
finally | ||
Pkg.setprotocol!() | ||
end | ||
end | ||
end | ||
end | ||
|
||
@testset "check logging" begin | ||
|