Skip to content

Commit 3d35bd0

Browse files
committed
pkg: pass locations to git not_found error
Signed-off-by: Ali Caglayan <[email protected]>
1 parent 0c97b28 commit 3d35bd0

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/dune_pkg/opamUrl0.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ type resolve =
5252
| Resolved of Rev_store.Object.resolved
5353
| Unresolved of Rev_store.Object.t
5454

55-
let not_found ~git_output t =
55+
let not_found ~loc ~git_output t =
5656
let url = base_url t in
5757
let rev = rev t in
5858
let git_output = List.map ~f:Pp.verbatim git_output in
5959
Error
60-
(User_message.make
60+
(User_message.make ~loc
6161
@@ git_output
6262
@ [ (match rev with
6363
| None -> Pp.textf "default branch not found in %s" url
@@ -91,7 +91,7 @@ let resolve t ~loc rev_store =
9191
| `Ref revision ->
9292
Rev_store.resolve_revision rev_store remote ~revision
9393
>>| (function
94-
| None -> not_found ~git_output:[] t
94+
| None -> not_found ~loc ~git_output:[] t
9595
| Some o -> Ok (Resolved o))
9696
;;
9797

@@ -103,7 +103,7 @@ let fetch_revision t ~loc resolve rev_store =
103103
| Unresolved o ->
104104
Rev_store.fetch_object rev_store remote o
105105
>>| (function
106-
| Error git_output -> not_found ~git_output t
106+
| Error git_output -> not_found ~loc ~git_output t
107107
| Ok rev -> Ok rev)
108108
;;
109109

src/dune_pkg/rev_store.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,7 @@ let run_with_exit_code { dir; _ } ~allow_codes ~display args =
486486
minimum supported version is Git 2.29."
487487
]
488488
~hints:[ User_message.command "Please update your git version." ]
489-
| _ ->
490-
Console.print [ Pp.verbatim stderr ];
491-
Error { Git_error.dir; args; exit_code; output = [] })
489+
| _ -> Error { Git_error.dir; args; exit_code; output = [ stderr ] })
492490
;;
493491

494492
let run t ~display args =

0 commit comments

Comments
 (0)