(* 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 object format implementation in pure OCaml. This library provides type-safe encoding and decoding of Git objects: blobs, trees, commits, and tags. It is derived from {{:https://github.com/mirage/ocaml-git}mirage/ocaml-git} and {{:https://github.com/robur-coop/carton}robur-coop/carton}. {1 Object types} Git stores four types of objects: - {!Blob}: File contents - {!Tree}: Directory listings (entries with mode, name, and hash) - {!Commit}: Snapshots with metadata (tree, parents, author, committer, message) - {!Tag}: Named references to objects with optional signature {1 Example} {[ (* Create a blob *) let blob = Git.Blob.of_string "Hello, World!\n" let blob_hash = Git.Blob.digest blob (* Create a tree entry *) let entry = Git.Tree.entry ~perm:`Normal ~name:"hello.txt" blob_hash let tree = Git.Tree.v [ entry ] let tree_hash = Git.Tree.digest tree (* Create a commit *) let author = Git.User.v ~name:"Alice" ~email:"alice@example.com" () let commit = Git.Commit.v ~tree:tree_hash ~author ~committer:author (Some "Initial commit") let commit_hash = Git.Commit.digest commit ]} *) module Hash = Hash (** Git object hashes (SHA-1). *) module User = User (** Git user information (author/committer). *) module Blob = Blob (** Git blob objects (file contents). *) module Tree = Tree (** Git tree objects (directory listings). *) module Commit = Commit (** Git commit objects. *) module Tag = Tag (** Git tag objects. *) module Value = Value (** Git values (union of all object types). *) module Reference = Reference (** Git references (branches, tags, HEAD). *) module Pack = Pack (** Git pack files (compressed object storage). *) module Pack_index = Pack_index (** Git pack index files (fast object lookup). *) module Repository = Repository (** Git repository access (loose objects + pack files). *) module Rev_list = Rev_list (** Commit graph traversal and topological ordering. *) module Subtree = Subtree (** Fast subtree split with persistent caching. *) module Config = Config (** Git config file parsing (.git/config). *) module Index = Index (** Git index (staging area) operations. *) module Remote = Remote (** Git remote queries via smart HTTP protocol. *) module Diff = Diff (** Git diff operations. *) module Worktree = Worktree (** Git worktree operations. *)