From e229c55e63510d8480e38d81eaa40fc85b1d37b2 Mon Sep 17 00:00:00 2001 From: mefyl Date: Fri, 16 Oct 2026 13:19:18 +0200 Subject: [PATCH] fix(pkg): show git output *after* the generic error message. Signed-off-by: mefyl --- doc/changes/fixed/16623.md | 5 +++-- src/dune_pkg/opamUrl0.ml | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/changes/fixed/16623.md b/doc/changes/fixed/16623.md index a09241106f6..2d6642c341e 100644 --- a/doc/changes/fixed/16623.md +++ b/doc/changes/fixed/16623.md @@ -1,2 +1,3 @@ -- Do not report unrelated git remote errors as "revision does not exist" - (#16623, fixes #16466, @mefyl) +- Do not report unrelated git remote errors as "revision does not exist", make + the git error more readable in the error message (#16623, #16628, fixes + #16466, @mefyl) diff --git a/src/dune_pkg/opamUrl0.ml b/src/dune_pkg/opamUrl0.ml index 2d627d307fe..c24bd50a3e8 100644 --- a/src/dune_pkg/opamUrl0.ml +++ b/src/dune_pkg/opamUrl0.ml @@ -43,15 +43,19 @@ let not_found ~loc t revision = ;; let fetch_failed ~loc ~git_output t obj = - let git_output = List.map ~f:Pp.verbatim git_output in + let git_output = + List.map ~f:Pp.(Pp.verbatimf "git| %s") + @@ List.concat + @@ List.map ~f:(fun line -> String.split ~on:'\n' @@ String.trim line) git_output + in Error (User_message.make ~loc - @@ git_output - @ [ Pp.textf + @@ (Pp.textf "could not fetch revision %S from %s" (Rev_store.Object.to_hex obj) (base_url t) - ]) + :: Pp.text "" + :: git_output)) ;; let resolve t ~loc rev_store =