Skip to content

Commit 98bf6f3

Browse files
dra27rjbou
authored andcommitted
Restore signature of OpamStateConfig.opamroot
1 parent d4a2733 commit 98bf6f3

6 files changed

+11
-5
lines changed

master_changes.md

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ users)
114114
## opam-repository
115115

116116
## opam-state
117+
* `OpamStateConfig.opamroot_with_provenance`: restore previous behaviour to `OpamStateConfig.opamroot` for compatibility with third party code [#6047 @dra27]
117118

118119
## opam-solver
119120

src/client/opamCliMain.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ let check_and_run_external_commands () =
181181
let yes = if yes then Some (Some true) else None in
182182
OpamCoreConfig.init ?yes ?confirm_level ();
183183
OpamFormatConfig.init ();
184-
let root_from, root_dir = OpamStateConfig.opamroot () in
184+
let root_from, root_dir = OpamStateConfig.opamroot_with_provenance () in
185185
let has_init, root_upgraded =
186186
match OpamStateConfig.load_defaults ~lock_kind:`Lock_read root_dir with
187187
| None -> (false, false)

src/client/opamClientConfig.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ let opam_init ?root_dir ?strict ?solver =
209209
let open OpamStd.Option.Op in
210210

211211
(* (i) get root dir *)
212-
let root_from, root = OpamStateConfig.opamroot ?root_dir () in
212+
let root_from, root = OpamStateConfig.opamroot_with_provenance ?root_dir () in
213213

214214
(* (ii) load conf file and set defaults *)
215215
(* the init for OpamFormat is done in advance since (a) it has an effect on

src/client/opamCommands.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ let global_options cli =
9494
switch_to_updated_self
9595
OpamStd.Option.Op.(options.debug_level ++
9696
OpamCoreConfig.E.debug () +! 0 |> abs > 0)
97-
(snd (OpamStateConfig.opamroot ?root_dir:options.opt_root ()));
97+
(OpamStateConfig.opamroot ?root_dir:options.opt_root ());
9898
let root_is_ok =
9999
OpamStd.Option.default false (OpamClientConfig.E.rootisok ())
100100
in

src/state/opamStateConfig.ml

+3-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ let initk k =
223223

224224
let init ?noop:_ = initk (fun () -> ())
225225

226-
let opamroot ?root_dir () =
226+
let opamroot_with_provenance ?root_dir () =
227227
match root_dir with
228228
| Some root -> `Command_line, win_space_redirection root
229229
| None ->
@@ -233,6 +233,8 @@ let opamroot ?root_dir () =
233233
| None ->
234234
`Default, default.root_dir
235235

236+
let opamroot ?root_dir () = snd (opamroot_with_provenance ?root_dir ())
237+
236238
let is_newer_raw = function
237239
| Some v ->
238240
OpamVersion.compare v OpamFile.Config.root_version > 0

src/state/opamStateConfig.mli

+4-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ val default : t
8686
(** Get the initial opam root value (from default, env or optional argument).
8787
This allows one to get it before doing the init, which is useful to get the
8888
configuration file used to fill some options to init() *)
89-
val opamroot: ?root_dir:dirname -> unit -> provenance * dirname
89+
val opamroot_with_provenance: ?root_dir:dirname -> unit -> provenance * dirname
90+
91+
(** [opamroot ?root_dir () = snd (opamroot_with_provenance ?root_dir ()] *)
92+
val opamroot: ?root_dir:dirname -> unit -> dirname
9093

9194
(** Loads the global configuration file, protecting against concurrent writes *)
9295
val load: ?lock_kind: 'a lock -> dirname -> OpamFile.Config.t option

0 commit comments

Comments
 (0)