-
Notifications
You must be signed in to change notification settings - Fork 349
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
base: master
Are you sure you want to change the base?
Conversation
src/client/opamCommands.ml
Outdated
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
src/client/opamCommands.ml
Outdated
| 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 = |
There was a problem hiding this comment.
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]
… actually exist" This reverts commit 2dccc99.
d0cde13
to
6a0b06e
Compare
Fixes #5012