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

Pinned packages created by "opam switch create ." should be kept up-to-date with the current git branch #4984

Open
kit-ty-kate opened this issue Jan 6, 2022 · 1 comment

Comments

@kit-ty-kate
Copy link
Member

$ git clone <my-ocaml-project> -b main
$ cd my-ocaml-project
$ opam switch create .
[creates a local switch and pin the project packages in it]
$ opam switch -c test
$ git branch -D main
$ opam update --dev

<><> Synchronising development packages <><><><><><><><><><><><><><><><><><>  🐫
[ERROR] Could not synchronize [....]
[mypkg] fetching sources failed: [...]

The git branch -D is only here to highlight the problem.
The issue is that the info from the opam files can be out-of-date or plain wrong.

In my opinion there should be an automated by of detecting that the pinned packages from the local directory in a local switch should be changed. opam update or opam install might be good places to check that and automatically change it.
There might need to be a new flag on pinned packages to tell it has been automatically added by opam and not manually by the user to avoid overwritting the user’s will.

@AltGr
Copy link
Member

AltGr commented Jan 7, 2022

Proposed solution (discussed together):

  • opam switch create . should pin to HEAD rather than current branch
  • For consistency, on later opam install . or opam pin, we should detect new pins to the switch-root directory (or a child ?) and direct them to HEAD rather than current branch
  • opam update could print a warning when the opam files present changed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants