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

Check that the repositories given to "opam repository remove" actually exist #5014

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

Conversation

kit-ty-kate
Copy link
Member

Fixes #5012

@rjbou rjbou added the PR: WIP Not for merge at this stage label Jan 20, 2022
Comment on lines 2208 to 2224
let seen_repos = ref [] in
let rm =
List.filter (fun n ->
(* TODO: Replace OpamRepositoryCommand.update_selection by
something that does not require dealing with such
horrible reference *)
let seen = List.mem n names in
if seen then begin
seen_repos := n :: !seen_repos;
end;
not seen)
in
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have in mind another way to do it without ref, i'll update later

Copy link
Collaborator

@rjbou rjbou Jan 20, 2022

Choose a reason for hiding this comment

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

updated the pr, a draft / proposal

| Some `remove, names ->
let names = List.map OpamRepositoryName.of_string names in
let rm = List.filter (fun n -> not (List.mem n names)) in
let seen_repos = ref [] in
let rm =
Copy link
Member Author

Choose a reason for hiding this comment

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

Actually this is not even called when the repository is not attached to a switch but exists in the global state so it returns an error even though it did something.

$ ./opam repo -a
[...]
tmp          [...]
$ ./opam repo remove tmp -a
[ERROR] No repository named tmp
$ ./opam repo -a
[...]
[no tmp]

@dra27 dra27 added this to PR in progress in Opam 2.2.0 via automation May 17, 2022
@rjbou rjbou self-assigned this May 18, 2022
@rjbou rjbou force-pushed the check-repos-remove-exist branch from d0cde13 to 6a0b06e Compare May 18, 2022 12:26
@rjbou rjbou self-requested a review January 23, 2023 13:47
@dra27 dra27 removed this from PR in progress in Opam 2.2.0 Jan 23, 2023
@dra27 dra27 added this to PR in Progress in Opam 2.3 via automation Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: WIP Not for merge at this stage
Projects
Opam 2.3
  
PR in Progress
Development

Successfully merging this pull request may close these issues.

Confused by opam remote remove when remote does not exist
2 participants