diff --git a/master_changes.md b/master_changes.md index fe42c861507..e68d2f848b7 100644 --- a/master_changes.md +++ b/master_changes.md @@ -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 @@ -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 diff --git a/src/state/opamPinned.ml b/src/state/opamPinned.ml index fac5d8ecd83..c92f3e5aa31 100644 --- a/src/state/opamPinned.ml +++ b/src/state/opamPinned.ml @@ -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 diff --git a/tests/reftests/lock.test b/tests/reftests/lock.test index ea2910f2432..37243ebdd5b 100644 --- a/tests/reftests/lock.test +++ b/tests/reftests/lock.test @@ -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 diff --git a/tests/reftests/pin.test b/tests/reftests/pin.test index 0f70077adb5..5a6b83269ab 100644 --- a/tests/reftests/pin.test +++ b/tests/reftests/pin.test @@ -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 +### +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)