Dagger.GitRepository (dagger v1.0.0-beta.19)

Copy Markdown View Source

A git repository.

Summary

Functions

Creates a synthetic workspace from this repository's HEAD and uncommitted file changes.

branches that match any of the given glob patterns.

Pack the given refs and the objects needed to reconstruct them into a Git bundle.

Returns details of a commit.

Return the sole remote, otherwise origin, otherwise the selected branch's upstream remote, otherwise null.

Returns details for HEAD.

A unique identifier for this GitRepository.

Return the latest stable release tag, falling back to HEAD when no release exists.

Look up a remote by name. Fails when the remote does not exist.

List this repository's named remotes, with registered remotes overriding configured ones. Does not contact remote servers.

tags that match any of the given glob patterns.

Returns the changeset of uncommitted changes in the git repository.

The URL of the git repository.

Import a Git bundle after fetching and verifying all of its prerequisites.

Replace this repository's storage with the supplied self-contained Git repository, retaining its logical URL and push destinations.

Register a named remote on this repository, replacing any registered remote of the same name.

Types

t()

@type t() :: %Dagger.GitRepository{client: term(), query_builder: term()}

Functions

as_workspace(git_repository, optional_args \\ [])

@spec as_workspace(t(), [{:cwd, String.t() | nil}]) :: Dagger.Workspace.t()

Creates a synthetic workspace from this repository's HEAD and uncommitted file changes.

Pending changes are applied at the repository root. The staging split is not preserved. The source repository is not modified.

branch(git_repository, name, optional_args \\ [])

@spec branch(t(), String.t(), [{:no_lock, boolean() | nil}]) :: Dagger.GitRef.t()

Returns details of a branch.

branches(git_repository, optional_args \\ [])

@spec branches(t(), [{:patterns, [String.t()]}]) ::
  {:ok, [String.t()]} | {:error, term()}

branches that match any of the given glob patterns.

bundle(git_repository, refs, optional_args \\ [])

@spec bundle(t(), [String.t()], [{:base, Dagger.GitRef.t() | nil}]) ::
  Dagger.GitBundle.t()

Pack the given refs and the objects needed to reconstruct them into a Git bundle.

commit(git_repository, id)

@spec commit(t(), String.t()) :: Dagger.GitCommit.t()

Returns details of a commit.

default_remote(git_repository)

@spec default_remote(t()) :: {:ok, Dagger.GitRemote.t() | nil} | {:error, term()}

Return the sole remote, otherwise origin, otherwise the selected branch's upstream remote, otherwise null.

Frozen workspaces retain their captured upstream selection. Does not contact remote servers.

head(git_repository, optional_args \\ [])

@spec head(t(), [{:no_lock, boolean() | nil}]) :: Dagger.GitRef.t()

Returns details for HEAD.

id(git_repository)

@spec id(t()) :: {:ok, String.t()} | {:error, term()}

A unique identifier for this GitRepository.

latest(git_repository, optional_args \\ [])

@spec latest(t(), version: String.t() | nil, no_lock: boolean() | nil) ::
  Dagger.GitRef.t()

Return the latest stable release tag, falling back to HEAD when no release exists.

Release selection accepts an optional "v" prefix, incomplete versions, and zero-padded numeric components. This operation is pinned unless noLock is enabled.

ref(git_repository, name, optional_args \\ [])

@spec ref(t(), String.t(), [{:no_lock, boolean() | nil}]) :: Dagger.GitRef.t()

Returns details of a ref.

remote(git_repository, name)

@spec remote(t(), String.t()) :: Dagger.GitRemote.t()

Look up a remote by name. Fails when the remote does not exist.

remotes(git_repository)

@spec remotes(t()) :: {:ok, [Dagger.GitRemote.t()]} | {:error, term()}

List this repository's named remotes, with registered remotes overriding configured ones. Does not contact remote servers.

tag(git_repository, name, optional_args \\ [])

@spec tag(t(), String.t(), [{:no_lock, boolean() | nil}]) :: Dagger.GitRef.t()

Returns details of a tag.

tags(git_repository, optional_args \\ [])

@spec tags(t(), [{:patterns, [String.t()]}]) :: {:ok, [String.t()]} | {:error, term()}

tags that match any of the given glob patterns.

uncommitted(git_repository)

@spec uncommitted(t()) :: Dagger.Changeset.t()

Returns the changeset of uncommitted changes in the git repository.

url(git_repository)

@spec url(t()) :: {:ok, String.t() | nil} | {:error, term()}

The URL of the git repository.

with_bundle(git_repository, bundle, optional_args \\ [])

@spec with_bundle(t(), Dagger.GitBundle.t(), [{:prerequisite_ref, String.t() | nil}]) ::
  t()

Import a Git bundle after fetching and verifying all of its prerequisites.

with_contents(git_repository, directory)

@spec with_contents(t(), Dagger.Directory.t()) :: t()

Replace this repository's storage with the supplied self-contained Git repository, retaining its logical URL and push destinations.

Accepts a whole checkout (including .git and pending file edits), .git contents, or a bare repository. Does not initialize a repository, merge histories, or modify either input.

The receiver's logical routing wins over the supplied Git configuration; that configuration is not rewritten. Use Directory.asGit to open the supplied repository without retaining the receiver's routing.

When the receiver is a remote repository (or was derived from one), that remote is retained with its authentication: refs the supplied storage does not contain resolve through it.

with_remote(git_repository, name, url, optional_args \\ [])

@spec with_remote(t(), String.t(), String.t(), [{:push_url, String.t() | nil}]) :: t()

Register a named remote on this repository, replacing any registered remote of the same name.

Registered remotes are recorded in checkouts materialized from this repository (GitRef.tree, Workspace.git.directory), so remote-aware tooling like gh can resolve and fetch from them. The origin remote also routes push when no explicit destination is passed: its push URL, or its URL, becomes the default destination.

Routing metadata only, never a credential grant: pushes still authenticate with the caller's own credentials and require approval as usual.