package git-unix

  1. Overview
  2. Docs

Parameters

module S : Git.Store.S

Signature

type t = S.t

Abstract value for stores.

type ctx

Connection context

The base Git protocol and Git+SSH

List the references of the remote repository.

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

Push a local branch to a remote store.

val fetch : ?ctx:ctx -> ?deepen:int -> ?unpack:bool -> ?capabilities:Git.Sync.capability list -> ?wants:Git.Sync.want list -> ?progress:(string -> unit) -> t -> Git.Gri.t -> Git.Sync.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:Git.Sync.capability list -> ?branch:Git.Sync.want -> ?progress:(string -> unit) -> t -> checkout:bool -> Git.Gri.t -> Git.Sync.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.

OCaml

Innovation. Community. Security.