Skip to content

Commit

Permalink
Merge #985
Browse files Browse the repository at this point in the history
985: fix rm: `project.extras` also contains dependency names r=00vareladavid a=00vareladavid

fixes #876 

Thanks @fredrikekre for getting it down to a minimal repro.

Co-authored-by: David Varela <[email protected]>
  • Loading branch information
bors[bot] and 00vareladavid committed Jan 14, 2019
2 parents d480435 + 27d452d commit 9839b33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,8 @@ function rm(ctx::Context, pkgs::Vector{PackageSpec})
@info "No changes"
return
end
deps_names = collect(keys(ctx.env.project.deps))
deps_names = append!(collect(keys(ctx.env.project.deps)),
collect(keys(ctx.env.project.extras)))
filter!(ctx.env.project.targets) do (target, deps)
!isempty(filter!(in(deps_names), deps))
end
Expand Down
12 changes: 12 additions & 0 deletions test/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,18 @@ end
end
end

#issue #876
@testset "targets should survive add/rm" begin
temp_pkg_dir() do project_path; cd_tempdir() do tmpdir
cp(joinpath(@__DIR__, "project", "good", "pkg.toml"), "Project.toml")
targets = deepcopy(Pkg.Types.read_project("Project.toml").targets)
Pkg.activate(".")
Pkg.add("Example")
Pkg.rm("Example")
@test targets == Pkg.Types.read_project("Project.toml").targets
end end
end

@testset "reading corrupted project files" begin
dir = joinpath(@__DIR__, "project", "bad")
for bad_project in joinpath.(dir, readdir(dir))
Expand Down

0 comments on commit 9839b33

Please sign in to comment.