Skip to content

Commit

Permalink
Merge pull request #6343 from kit-ty-kate/no-double-pin
Browse files Browse the repository at this point in the history
Stop double pin of packages located in ./opam/opam
  • Loading branch information
kit-ty-kate authored Jan 16, 2025
2 parents f36a1c8 + f926ed6 commit 436b4fe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
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 @@ -155,6 +156,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)

0 comments on commit 436b4fe

Please sign in to comment.