(* Copyright (c) 2024-2026 Thomas Gazagnaire Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) (** Fast-forwards of the current branch to a fetched commit, over any {!Store.S}. *) (** The type for the outcomes of a fast-forward. *) type outcome = | Up_to_date (** HEAD already is the fetched commit; nothing to do. *) | Fast_forwarded of Checkout.report (** The branch advanced to the fetched commit. *) | Not_fast_forward of { local : Object_hash.t; fetched : Object_hash.t } (** The fetched commit is not a descendant of HEAD; nothing changed. *) module Make (S : Checkout.S) : sig val fast_forward : S.t -> fetched:Object_hash.t -> (outcome, [ `Msg of string ]) result (** [fast_forward repo ~fetched] advances the current branch to [fetched] when that is a fast-forward of HEAD, applying the change to the working tree with {!Checkout.Make.fast_forward}. This is [Error] if HEAD is unborn. *) end