Skip to content

Commit

Permalink
update pin source : update working dir sources when pin url changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Feb 11, 2021
1 parent 3e63174 commit 911eb26
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/client/opamAuxCommands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ let autopin_aux st ?quiet ?(for_view=false) ?recurse ?subpath atom_or_local_list
let pinned_pkg = OpamPinned.package st name in
OpamSwitchState.primary_url st pinned_pkg = Some target
&&
(* For `opam show`, we need to check is the opam file changed to
(* For `opam show`, we need to check does the opam file changed to
perform a simulated pin if so *)
(not for_view ||
match
Expand Down Expand Up @@ -442,6 +442,16 @@ let autopin st ?(simulate=false) ?quiet ?recurse ?subpath atom_or_local_list =
in
st
in
let already_pinned_diff_url =
(* is pinned but no in already pinned because not same url *)
OpamStd.List.filter_map (fun (n,u,s,_) ->
try
if OpamPackage.Set.mem (OpamPinned.package st n) already_pinned_set then
None else Some (n,u,s)
with Not_found -> None
) to_pin
in

let st, pins =
if simulate then simulate_local_pinnings ?quiet st to_pin else
try
Expand All @@ -460,6 +470,10 @@ let autopin st ?(simulate=false) ?quiet ?recurse ?subpath atom_or_local_list =
with OpamPinCommand.Aborted ->
OpamStd.Sys.exit_because `Aborted
in
if OpamClientConfig.(!r.working_dir && not !r.inplace_build) then
ignore @@
OpamPinCommand.fetch_all_pins st ~working_dir:true
already_pinned_diff_url;
let st =
if OpamClientConfig.(!r.ignore_pin_depends) then st else
OpamPackage.Set.fold (fun nv st ->
Expand Down

0 comments on commit 911eb26

Please sign in to comment.