-
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
702: add support for "ssh" protocol r=KristofferC a=Evizero This is a minimalistic change to support the use of `Pkg.setprotocol!("ssh")` to fix #653. My naive reasoning here is that since "github" is hardcoded anyway, one might as well adapt the URL string for when using the ~~"git"~~ "ssh" protocol. Note though that this only works if the repo has not been cloned into ".julia/clones" already using the defaul setting (i.e. https). If that is the case then `dev Example` will say ``` Updating git-repo `[email protected]:JuliaLang/Example.jl.git` ``` while `git remote -v` in that new dev-ed directory will still show `origin` using the `https` version. Not sure where to fix that. 716: Update project.toml compat example r=KristofferC a=mcmcgrath13 Adding this PR here instead of [JuliaLang](JuliaLang/julia#28947) per @KristofferC Co-authored-by: Christof Stocker <[email protected]> Co-authored-by: Mary McGrath <[email protected]>
- Loading branch information
Showing
3 changed files
with
25 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
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 |
---|---|---|
|
@@ -262,6 +262,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 | ||
|