Git object storage and pack files for Eio
at main 83 lines 2.5 kB view raw
1(* Copyright (c) 2013-2017 Thomas Gazagnaire <thomas@gazagnaire.org> 2 Copyright (c) 2017-2024 Romain Calascibetta <romain.calascibetta@gmail.com> 3 Copyright (c) 2024-2026 Thomas Gazagnaire <thomas@gazagnaire.org> 4 5 Permission to use, copy, modify, and distribute this software for any 6 purpose with or without fee is hereby granted, provided that the above 7 copyright notice and this permission notice appear in all copies. 8 9 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) 16 17(** Git commit objects. *) 18 19type t 20(** The type of commits. *) 21 22val v : 23 tree:Hash.t -> 24 author:User.t -> 25 committer:User.t -> 26 ?parents:Hash.t list -> 27 ?extra:(string * string list) list -> 28 string option -> 29 t 30(** Create a commit. *) 31 32val tree : t -> Hash.t 33(** The tree hash. *) 34 35val parents : t -> Hash.t list 36(** The parent commit hashes. *) 37 38val author : t -> User.t 39(** The author. *) 40 41val committer : t -> User.t 42(** The committer. *) 43 44val message : t -> string option 45(** The commit message. *) 46 47val extra : t -> (string * string list) list 48(** Extra headers (e.g., gpgsig). *) 49 50val pp : t Fmt.t 51(** Pretty-print a commit. *) 52 53val equal : t -> t -> bool 54(** Equality on commits. *) 55 56val compare : t -> t -> int 57(** Total ordering on commits. *) 58 59val compare_by_date : t -> t -> int 60(** Compare commits by author date. *) 61 62val hash : t -> int 63(** Hash function for use with Hashtbl. *) 64 65val to_string : t -> string 66(** Encode to git format. *) 67 68val of_string : string -> (t, [ `Msg of string ]) result 69(** Parse from git format. *) 70 71val of_string_exn : string -> t 72(** [of_string_exn s] is like {!of_string} but raises on error. *) 73 74val of_reader : Bytesrw.Bytes.Reader.t -> (t, [ `Msg of string ]) result 75(** Parse a commit directly from a {!Bytesrw.Bytes.Reader.t} without 76 materialising the full object into a string. The reader must be positioned 77 at the start of the commit body (after the loose-object header, if any). *) 78 79val digest : t -> Hash.t 80(** Compute the git hash of a commit. *) 81 82module Set : Set.S with type elt = t 83module Map : Map.S with type key = t