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

Ensure each repositories stored in repos-config is associated with an URL #6249

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

kit-ty-kate
Copy link
Member

@kit-ty-kate kit-ty-kate commented Oct 17, 2024

This is mostly cleanup work noticed as i was looking at implementing #5553.

Looking at the code of OpamFile.Repos_config, i got surprised having repositories without any url was allowed ('a option) so i digged a little and it seems that the None state is not used anywhere:

  • the InitConfig parser would refuse it with Missing repository URL
  • manually entering it in repos-config would be accepted but ignored internally and i have no idea why it would ever be used

In any case, this special case is not tested anywhere in the test-suite either so it looks reasonable to assume it was never meant to be handled, and reading the commit that added that possibility 667eacd, it seems to have been added with the idea that "it might be useful in the future", but 8 years later i don't think it turned out true at all.

ocaml-opam/opam-rt#79 should be merged first right before merging this PR

Copy link
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on the idea!
Even if it is not used, it needs a test to see the change and no change that are written in the main comment.

@kit-ty-kate
Copy link
Member Author

Even if it is not used, it needs a test to see the change and no change that are written in the main comment.

I'm not sure to understand. Aside from crafting a custom repos-config file which can't happen in the wild i don't think there is a way to test this.

@rjbou
Copy link
Collaborator

rjbou commented Nov 22, 2024

That's the idea :)

Copy link
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a test, it's mainly in the idea to thee the diff, even if it can't happen with the binary

@kit-ty-kate kit-ty-kate merged commit 84a949f into ocaml:master Nov 22, 2024
42 checks passed
@kit-ty-kate kit-ty-kate deleted the repositories-no-url-opt branch November 22, 2024 17:14
kit-ty-kate added a commit to ocaml-opam/opam-rt that referenced this pull request Nov 22, 2024
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.

2 participants