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 using the untracked local opam file on opam pin ./local-vcs #6409

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rjbou
Copy link
Collaborator

@rjbou rjbou commented Mar 5, 2025

fix #6408
I'm not fully satisfied with that solution...

This PR changes the behaviour of opam pin add ./local-vcs which would take the opam files from the VCS repository even if they had untracked changes. This behaviour exists since opam 2.1 (see #4300) but opam 2.0 didn't have the same behaviour.
The addition of a note about untracked changes can be added separately and is tracked by #6414

@rjbou rjbou added KIND: BUG PR: WIP Not for merge at this stage labels Mar 5, 2025
@kit-ty-kate
Copy link
Member

kit-ty-kate commented Mar 8, 2025

After lengthy reviewing and tinkering i wasn't satisfied with the solution either so i came up with a different proposal, which while a bit radical i strongly believe to be a positive change for users:

Currently pinning a local vcs directory will override the opam files with whatever the version in the working directory is, regardless of whether or not --working-dir is given. I think this behaviour is too surprising to users. If they wish to use the working directory version then they can pass --working-dir explicitly. This also has the side-effect to simplify our code quite a lot which is always nice.

I've pushed the proposal as the fixup proposal commit above. The parent fixup commit implements a couple of cleanups (probably mostly redundant if the proposal is to be accepted), and i've also added a commit at the top to change the return type of OpamRepository.revision which shouldn't have had the version type.

What do you think?

@kit-ty-kate kit-ty-kate force-pushed the pin-magic-local-opam-branch-fix branch from 413eee3 to ec45d71 Compare March 10, 2025 18:16
@kit-ty-kate kit-ty-kate changed the title Fix opam file lookup when a pin is done with a local directory and a branch is specified Stop using the untracked local opam file on opam pin ./local-vcs Mar 10, 2025
@kit-ty-kate kit-ty-kate removed the PR: WIP Not for merge at this stage label Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

opam pin ./local#mybranch does not take mybranch opam file
2 participants