Skip to content

Commit

Permalink
Revert "Check that the repositories given to "opam repository remove"…
Browse files Browse the repository at this point in the history
… actually exist"

This reverts commit 2dccc99.
  • Loading branch information
rjbou committed Jan 20, 2022
1 parent 55a2005 commit 27f19fa
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions src/client/opamCommands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2199,24 +2199,9 @@ let repository cli =
(OpamSwitch.to_string (OpamStateConfig.get_switch ()))
(OpamRepositoryName.to_string name);
`Ok ()
| Some `remove, [] ->
OpamConsole.error_and_exit `Not_found
"No repository name was given, \
please give at least one name in parameter"
| Some `remove, names ->
let names = List.map OpamRepositoryName.of_string names in
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
let rm = List.filter (fun n -> not (List.mem n names)) in
let full_wipe = List.mem `All scope in
let global = global || full_wipe in
let gt =
Expand All @@ -2235,14 +2220,7 @@ let repository cli =
"Repositories removed from the selections of switch %s. \
Use '--all' to forget about them altogether.\n"
(OpamSwitch.to_string (OpamStateConfig.get_switch ()));
begin match List.filter (fun n -> not (List.mem n !seen_repos)) names with
| [] -> `Ok ()
| not_seen_repos ->
List.iter (fun repo ->
OpamConsole.error "No repository named %s" (OpamRepositoryName.to_string repo)
) not_seen_repos;
OpamStd.Sys.exit_because `Not_found
end
`Ok ()
| Some `add, [name] ->
let name = OpamRepositoryName.of_string name in
OpamRepositoryState.with_ `Lock_none gt (fun rt ->
Expand Down

0 comments on commit 27f19fa

Please sign in to comment.