Skip to content

Commit

Permalink
Fix combinations of opam tree --{tree,doc} and --no-switch
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed May 3, 2024
1 parent ad996d2 commit dc707b5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ users)

## Tree
* Fix opam tree --test --doc assigning the with-{test,doc} variables to unrequested packages [#5919 @kit-ty-kate - fix #5755]
* Fix combinations of opam tree --{tree,doc} and --no-switch [#5919 @kit-ty-kate - fix #5920]

## Exec

Expand Down
8 changes: 7 additions & 1 deletion src/client/opamTreeCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,13 @@ let run st tog ?no_constraint mode filter atoms =
(OpamPackage.Set.empty, []) atoms
in
let st, universe =
let universe = get_universe tog select st in
let universe =
let requested =
OpamFormula.packages_of_atoms
(if missing = [] then st.installed else st.packages) atoms
in
get_universe tog requested st
in
match mode, filter, missing with
| Deps, _, [] -> st, universe
| Deps, Roots_from, _::_ ->
Expand Down
12 changes: 8 additions & 4 deletions tests/reftests/tree.test
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,14 @@ h.1
'-- b.1 (>= 1 & < 3) [*]
### opam tree j --with-test
The following actions are simulated:
=== install 2 packages
=== install 3 packages
- install a 1 [required by j]
- install j 1
- install k 1 [required by j]

j.1
'-- a.1
|-- a.1
'-- k.1 (with-test)
### opam tree e
The following actions are simulated:
=== install 3 packages
Expand Down Expand Up @@ -488,13 +490,15 @@ e.1
'-- a.1
### opam tree e --with-test --no-switch
The following actions are simulated:
=== install 3 packages
=== install 4 packages
- install a 1 [required by e]
- install b 1
- install d 1 [required by e]
- install e 1

e.1
'-- a.1
|-- a.1
'-- d.1 (< 2 & with-test)
### : invariant
### <pkg:h.1>
opam-version: "2.0"
Expand Down

0 comments on commit dc707b5

Please sign in to comment.