Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,10 @@ end

function handle_package_input!(pkg::PackageSpec)
if pkg.path !== nothing && pkg.url !== nothing
pkgerror("`path` and `url` are conflicting specifications")
pkgerror("Conflicting `path` and `url` in PackageSpec")
end
if pkg.repo.source !== nothing || pkg.repo.rev !== nothing || pkg.repo.subdir !== nothing
pkgerror("`repo` is a private field of PackageSpec and should not be set directly")
end
pkg.repo = Types.GitRepo(rev = pkg.rev, source = pkg.url !== nothing ? pkg.url : pkg.path,
subdir = pkg.subdir)
Expand Down
2 changes: 1 addition & 1 deletion src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ mutable struct PackageSpec
uuid::Union{Nothing,UUID}
version::Union{Nothing,VersionTypes,String}
tree_hash::Union{Nothing,SHA1}
repo::GitRepo
repo::GitRepo # private
path::Union{Nothing,String}
pinned::Bool
# used for input only
Expand Down
2 changes: 2 additions & 0 deletions test/new.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2164,6 +2164,8 @@ end
Pkg.dependencies(exuuid) do pkg
@test pkg.version > v"0.3.0"
end

@test_throws PkgError("`repo` is a private field of PackageSpec and should not be set directly") Pkg.add([PackageSpec(;repo=Pkg.Types.GitRepo(source="someurl"))])
end
end

Expand Down
Loading