Trebejo.Git.Local.Clone (Trebejo v2.0.0)

Copy Markdown View Source

Git repository cloning, update and existence-check operations.

Summary

Functions

Clones a repository from url to path.

Clones a repository from a URL to a target path.

Ensures a repository is cloned. If it already exists, updates it.

Returns a tree string of existing (already-cloned) repositories from a list of {:repo_exists | :repo_error, map(), ...} tuples.

Fetches all changes from origin.

Fetches repository updates from origin.

Updates an existing repository by fetching from origin.

Functions

clone(repo)

@spec clone(map()) :: {:ok, map()} | {:error, any()}

Clones a repository from url to path.

clone_repository(url, target_path)

@spec clone_repository(binary(), binary()) :: {:ok, binary()} | {:error, any()}

Clones a repository from a URL to a target path.

ensure_clone(atom)

@spec ensure_clone(nil) :: {:error, :no_repo_defined}

Ensures a repository is cloned. If it already exists, updates it.

Accepts a single repo map, a list of repo maps, or nil.

ensure_clone(repos, workspace_path)

@spec ensure_clone([map()], binary()) :: [
  {:repo_exists | :repo_cloned, map()} | {:repo_error, map(), term()}
]
@spec ensure_clone(map(), binary()) ::
  {:repo_exists | :repo_cloned, map()} | {:repo_error, map(), term()}

existing_repos(repos)

@spec existing_repos([tuple()]) :: binary()

Returns a tree string of existing (already-cloned) repositories from a list of {:repo_exists | :repo_error, map(), ...} tuples.

fetch_all_changes(repo_path)

@spec fetch_all_changes(binary()) :: {:ok, binary()} | {:error, any()}

Fetches all changes from origin.

fetch_repository_updates(repo_path)

@spec fetch_repository_updates(binary()) :: {:ok, binary()} | {:error, any()}

Fetches repository updates from origin.

update_existing_repository(repo_path)

@spec update_existing_repository(binary()) :: {:ok, binary()} | {:error, any()}

Updates an existing repository by fetching from origin.