(* Copyright (c) 2013-2017 Thomas Gazagnaire Copyright (c) 2017-2024 Romain Calascibetta 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. *) (** Git commit objects. *) type t (** The type of commits. *) val v : tree:Hash.t -> author:User.t -> committer:User.t -> ?parents:Hash.t list -> ?extra:(string * string list) list -> string option -> t (** Create a commit. *) val tree : t -> Hash.t (** The tree hash. *) val parents : t -> Hash.t list (** The parent commit hashes. *) val author : t -> User.t (** The author. *) val committer : t -> User.t (** The committer. *) val message : t -> string option (** The commit message. *) val extra : t -> (string * string list) list (** Extra headers (e.g., gpgsig). *) val pp : t Fmt.t (** Pretty-print a commit. *) val equal : t -> t -> bool (** Equality on commits. *) val compare : t -> t -> int (** Total ordering on commits. *) val compare_by_date : t -> t -> int (** Compare commits by author date. *) val hash : t -> int (** Hash function for use with Hashtbl. *) val to_string : t -> string (** Encode to git format. *) val of_string : string -> (t, [ `Msg of string ]) result (** Parse from git format. *) val of_string_exn : string -> t (** [of_string_exn s] is like {!of_string} but raises on error. *) val of_reader : Bytesrw.Bytes.Reader.t -> (t, [ `Msg of string ]) result (** Parse a commit directly from a {!Bytesrw.Bytes.Reader.t} without materialising the full object into a string. The reader must be positioned at the start of the commit body (after the loose-object header, if any). *) val digest : t -> Hash.t (** Compute the git hash of a commit. *) module Set : Set.S with type elt = t module Map : Map.S with type key = t