Skip to content

Commit

Permalink
refactor(pkg): remove some copy pasting (#10499)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored May 13, 2024
1 parent 15ef9f9 commit 793162a
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/dune_pkg/rev_store.ml
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,6 @@ let env =
|> Env.add ~var:"GIT_TERMINAL_PROMPT" ~value:"0"
;;

let git_code_error ~dir ~args ~exit_code ~output =
let git = Lazy.force Vcs.git in
Code_error.raise
"git returned non-zero exit code"
[ "exit code", Dyn.int exit_code
; "dir", Path.to_dyn dir
; "git", Path.to_dyn git
; "args", Dyn.list Dyn.string args
; "output", Dyn.list Dyn.string output
]
;;

module Git_error = struct
type t =
{ dir : Path.t
Expand Down Expand Up @@ -727,7 +715,8 @@ module At_rev = struct
let+ (), exit_code =
Process.run ~dir ~display:Quiet ~stdout_to ~stderr_to ~env failure_mode git args
in
if exit_code <> 0 then git_code_error ~dir ~args ~exit_code ~output:[]
if exit_code <> 0
then Git_error.raise_code_error { dir; args; exit_code; output = [] }
in
(* We untar things into a temp dir to make sure we don't create garbage
in the build dir until we know can produce the files *)
Expand Down

0 comments on commit 793162a

Please sign in to comment.