Create an on-disk store implementation.
module D : Hash.DIGEST
val root : t -> string
The location of the repository root (or any other meaningful name to be displayed to the user). By default, it is the current directory.
val level : t -> int
level used when creating new Git objects. must be between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). The default value (currently equivalent to level 6) requests a default compromise between speed and compression.
read but raises
Not_found if no object with the given Hash is found.
Write a value and return the Hash of its serialized contents.
val write_pack : t -> Pack.raw -> Hash.Set.t Lwt.t
Write a raw pack file and the corresponding index. Return the objects IDs which have been written.
val references : t -> Reference.t list Lwt.t
Return the list of references (ie. tags and branches).
val mem_reference : t -> Reference.t -> bool Lwt.t
Check if a reference exists.
val read_reference : t -> Reference.t -> Hash.t option Lwt.t
Read a given reference.
val read_reference_exn : t -> Reference.t -> Hash.t Lwt.t
Read a given reference.
val write_head : t -> Reference.head_contents -> unit Lwt.t
Write the HEAD.
val read_head : t -> Reference.head_contents option Lwt.t
Read the head contents.
val write_reference : t -> Reference.t -> Hash.t -> unit Lwt.t
Write a reference.
val remove_reference : t -> Reference.t -> unit Lwt.t
Remove a reference. Note: packed references cannot be removed (and no error will be raised) so assume that
r is unsafe as it could either delete
r, do nothing, or revert
r to a previous (packed) value.
val test_and_set_reference : t -> Reference.t -> test:Hash.t option -> set:Hash.t option -> bool Lwt.t
Atomic updates (Test and set) for references. Note: when
test_and_set_reference should be considered unsafe. See
remove_reference for details.
Git index files
val write_index : t -> ?index:Index.t -> Hash.Commit.t -> unit Lwt.t
Update the index file for the given revision. A side-effect of this operation is that the blobs are expanded into the filesystem.
Note: It is the user responsability to ensure that filenames are valid. No sanitazition is done by the library -- the Git format does not impose a filename format as this is a constraint of the underlying filesystem.
index is not set, read the current index and update it with the current state of the filesystem.
module Digest : Hash.DIGEST
Digest functions that the store is using.
Create a file on the filesystem, with the given mode.
val entry_of_file : t -> Index.t -> string -> Tree.perm -> Hash.Blob.t -> Blob.t -> Index.entry option Lwt.t
Generate a cache entry for the file. Create a fresh file if it does not already exist. If
root is not set, use the current working directory as repository root.