Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ users)
## Version

## Global CLI
* Make error message for opam repo add more explicit [#7014 @yannl35133 - fix #6943]

## Plugins

Expand Down
17 changes: 15 additions & 2 deletions src/client/opamRepositoryCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ let add rt name url trust_anchors =
-> rt
| Some r ->
OpamConsole.error_and_exit `Bad_arguments
"Repository %s is already set up%s. To change that, use 'opam \
repository set-url %s %s'."
"Repository %s has already been globally set up%s. \
To add the repository to the current switch as is, \
use 'opam repository add %s'; \
to change the %s, \
use 'opam repository set-url %s %s%s'."
(OpamRepositoryName.to_string name)
(if r.repo_url <> url then
" and points to "^OpamUrl.to_string r.repo_url
Expand All @@ -76,7 +79,17 @@ let add rt name url trust_anchors =
ta.fingerprints)
ta.quorum)
(OpamRepositoryName.to_string name)
(if r.repo_url <> url then "address" else "trust anchors")
(OpamRepositoryName.to_string name)
(OpamUrl.to_string url)
(match trust_anchors with
| None -> ""
| Some ta ->
(* TODO: is this the correct syntax? *)
Printf.sprintf " %d %s"
ta.quorum
(OpamStd.List.concat_map " " String.escaped
ta.fingerprints))
| None ->
let repo = { repo_name = name; repo_url = url;
repo_trust = trust_anchors; }
Expand Down