Skip to content

Commit

Permalink
Stop double pin of packages located in ./opam/opam
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Dec 19, 2024
1 parent 26290a4 commit 72a5879
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 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
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
5 changes: 1 addition & 4 deletions tests/reftests/lock.test
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,10 @@ Done.
opam-version: "2.0"
name: "silver"
depends: "foo"
### # ERROR double silver
### : Make sure silver isn't pinned twice
### 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

0 comments on commit 72a5879

Please sign in to comment.