Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -1557,7 +1557,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 @@ -92,7 +92,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
4 changes: 3 additions & 1 deletion test/new.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,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=LibGit2.GitRepo(url="someurl"))])
end
end

Expand Down Expand Up @@ -2069,7 +2071,7 @@ end
end
end
end
end
end
end

#
Expand Down
Loading