package git

  1. Overview
  2. Docs


module IO : IO
module S : Store.S


type t = S.t

Abstract value for stores.

type ctx = IO.ctx

Connection context

The base Git protocol and Git+SSH

val ls : ?ctx:ctx -> t -> Gri.t -> Hash.t Reference.Map.t Lwt.t

List the references of the remote repository.

val push : ?ctx:ctx -> t -> branch:Reference.t -> Gri.t -> Result.push Lwt.t

Push a local branch to a remote store.

val fetch : ?ctx:ctx -> ?deepen:int -> ?unpack:bool -> ?capabilities:capability list -> ?wants:want list -> ?progress:(string -> unit) -> t -> Gri.t -> Result.fetch Lwt.t

fetch t uri fetches the contents of uri into the store t.

By default, all the remote references are updated. This behavior can be changed by using the wants parameter:

  • if wants is not specified, the objects corresponding to all the remote references are downloaded. This is useful when cloning a new repository as the remote references are not yet known.
  • If a reference (e.g. a `Ref want value) appears in the list, the object corresponding to that remote reference are fetched. This works only if the server exports the "allow-reachable-sha1-in-want" (available in Git 2.5.0)
  • If a commit hash (e.g. a `Commit want value) in the list, the objects corresponding to the that remote commits are fetched..

Note: the local HEAD is not modified when doing a fetch. To do so (for instance when doing a clone) do the following:

fetch t gri >>= fun r ->
match Result.head_contents r with
| Some h -> Store.write_head t h
| None   -> Lwt.return_unit
val clone : ?ctx:ctx -> ?deepen:int -> ?unpack:bool -> ?capabilities:capability list -> ?branch:want -> ?progress:(string -> unit) -> t -> checkout:bool -> Gri.t -> Result.fetch Lwt.t

Similar to fetch but also initialise HEAD and a the specified branch. If branch is not specified, initialise all the references that the remote repository exposes.


Innovation. Community. Security.