From de01cb5dd51b8d964324256f58ddcb4576acdc5e Mon Sep 17 00:00:00 2001 From: Yann Leray Date: Wed, 8 Jul 2026 14:14:11 +0200 Subject: [PATCH 1/2] Make error message for opam repo add more explicit --- src/client/opamRepositoryCommand.ml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/client/opamRepositoryCommand.ml b/src/client/opamRepositoryCommand.ml index 4aad4341784..07928ede24b 100644 --- a/src/client/opamRepositoryCommand.ml +++ b/src/client/opamRepositoryCommand.ml @@ -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 @@ -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; } From 9e720ab2671803c193610a82e0a4aac360cd71f9 Mon Sep 17 00:00:00 2001 From: Yann Leray Date: Wed, 8 Jul 2026 14:21:05 +0200 Subject: [PATCH 2/2] add master_changes entry --- master_changes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/master_changes.md b/master_changes.md index c0c63c6d7a8..dffdb551e4c 100644 --- a/master_changes.md +++ b/master_changes.md @@ -13,6 +13,7 @@ users) ## Version ## Global CLI + * Make error message for opam repo add more explicit [#7014 @yannl35133 - fix #6943] ## Plugins