diff --git a/src/Operations.jl b/src/Operations.jl index f3ddd02e6e..2dc60dec46 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -235,7 +235,7 @@ function fixups_from_projectfile!(ctx::Context) # pkg.exts = p.exts # TODO: STDLIBS_BY_VERSION doesn't record this # pkg.entryfile = p.entryfile # TODO: STDLIBS_BY_VERSION doesn't record this for (name, _) in pkg.weakdeps - if !haskey(p.deps, name) + if !(name in p.deps) delete!(pkg.deps, name) end end diff --git a/test/historical_stdlib_version.jl b/test/historical_stdlib_version.jl index e19574155d..7720e2a91f 100644 --- a/test/historical_stdlib_version.jl +++ b/test/historical_stdlib_version.jl @@ -255,6 +255,11 @@ isolate(loaded_depot=true) do end end + @testset "Old Pkg add regression" begin + Pkg.activate(temp=true) + Pkg.add(; name="Pkg", julia_version=v"1.11") + end + @testset "Stdlib add" begin Pkg.activate(temp=true) # Stdlib add (current julia version)