Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop double pin of packages located in ./opam/opam #6343

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ users)

## Pin
* [NEW] Make it so pin list display the current revision of a pinned repository in a new column [#6274 @desumn - fix #5533]
* [BUG] Stop double pin of packages located in ./opam/opam [#6343 @kit-ty-kate - fix #6342]

## List

Expand Down Expand Up @@ -154,6 +155,7 @@ users)
* Add switch removal test: failure on removal linked switch [#6276 @btjorge]
* Extend the tests on opam admin to include packages using builtin global variables [#6331 @kit-ty-kate]
* Extend the tests on opam admin check by including all the arguments [#6331 @kit-ty-kate @rjbou]
* Add double pinning test in case of opam/opam opam file [#6343 @rjbou]

### Engine

Expand Down
5 changes: 2 additions & 3 deletions src/state/opamPinned.ml
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ let files_in_source ?locked ?(recurse=false) ?subpath d =
in
List.fold_left
(fun acc d ->
if OpamFilename.(basename_dir d = Base.of_string "opam") ||
OpamStd.String.ends_with ~suffix:".opam"
(OpamFilename.Dir.to_string d)
if OpamStd.String.ends_with ~suffix:".opam"
(OpamFilename.Dir.to_string d)
then
match OpamFilename.opt_file OpamFilename.Op.(d//"opam") with
| None -> acc
Expand Down
4 changes: 0 additions & 4 deletions tests/reftests/lock.test
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,9 @@ Done.
opam-version: "2.0"
name: "silver"
depends: "foo"
### # ERROR double silver
### opam pin -n old
This will pin the following packages: silver, silver. Continue? [Y/n] y
Package silver does not exist, create as a NEW package? [Y/n] y
silver is now pinned to file://${BASEDIR}/old (version dev)
[NOTE] Package silver is already pinned to file://${BASEDIR}/old (version dev).
silver is now pinned to file://${BASEDIR}/old (version dev)
### opam lock silver
Generated lock files for:
- silver.dev: ${BASEDIR}/silver.opam.locked
Expand Down
7 changes: 7 additions & 0 deletions tests/reftests/pin.test
Original file line number Diff line number Diff line change
Expand Up @@ -937,3 +937,10 @@ vcs-local is now pinned to git+file://${BASEDIR}/vcs-local#master (version dev)
### opam show vcs-local --field build:,url.src:
build: "false"
url.src: "git+file://${BASEDIR}/vcs-local#master"
### :C:b: double pinning when the opam file is opam/opam
### <pin:double/opam/opam>
opam-version: "2.0"
name: "double"
### opam pin -n double
Package double does not exist, create as a NEW package? [Y/n] y
double is now pinned to file://${BASEDIR}/double (version dev)
Loading