JuliaLang / Pkg.jl

Pkg - Package manager for the Julia programming language
https://pkgdocs.julialang.org
Other
609 stars 251 forks source link

[workspace] Misleading printing of Manifest.toml change #3891

Open fredrikekre opened 2 months ago

fredrikekre commented 2 months ago

Example:

$ tree .
.
├── Manifest.toml
├── Project.toml
└── test
    └── Project.toml

$ cat Project.toml
[deps]
Example = "7876af07-990d-54b4-ab0e-23690620f79a"

[workspace]
projects = ["test"]

$ julia -e 'using Pkg; Pkg.status()'
Status `/tmp/tmp.C9bJWtPVPR/Project.toml`
  [7876af07] Example v0.5.4 `https://github.com/JuliaLang/Example.jl.git#master`

$ julia --project=test -e 'using Pkg; Pkg.status()'
Status `/tmp/tmp.C9bJWtPVPR/test/Project.toml` (empty project)

$ julia --project=test -e 'using Pkg; Pkg.add("Example")'
   Resolving package versions...
    Updating `/tmp/tmp.C9bJWtPVPR/test/Project.toml`
  [7876af07] + Example v0.5.3
    Updating `/tmp/tmp.C9bJWtPVPR/Manifest.toml`
  [7876af07] + Example v0.5.3

The last line there should be

  [7876af07] ~ Example v0.5.4 `https://github.com/JuliaLang/Example.jl.git#master` ⇒ v0.5.3

instead of

  [7876af07] + Example v0.5.3
KristofferC commented 2 months ago

The reason this happens is that the status printer does a filter of everything that is reachable from the current project and uses that as a diff. Here, Example was not reachable before so it just has it as a +.

fredrikekre commented 2 months ago

Okay, that explains why it works correctly when the thing you add is already a transient dependency in the current project.