Dagger
Search

git

This module has been generated via dagger init and serves as a reference to
basic module structure as you get started with Dagger.

Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.

The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.

Installation

dagger install github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06

Entrypoint

Return Type
Git !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Git repository directory (must include .git)
imageRegistryString "docker.io"Git image registry
imageRepositoryString "alpine/git"Git image repositroy
imageTagString "2.52.0"Git image tag
userIdString "65532"Git image user
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
func (m *MyModule) Example() *dagger.Git  {
	return dag.
			Git()
}
@function
def example() -> dagger.Git:
	return (
		dag.git()
	)
@func()
example(): Git {
	return dag
		.git()
}

Types

Git 🔗

container() 🔗

Creates container with configured git

Return Type
Container !
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 container
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Git().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.git()
		.container()
	)
@func()
example(): Container {
	return dag
		.git()
		.container()
}

fetchTags() 🔗

Fetch tags from remote.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
remoteString !"origin"Remote name to fetch tags from
pruneBoolean falsePrune deleted tags
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 fetch-tags --remote string
func (m *MyModule) Example(ctx context.Context, remote string) string  {
	return dag.
			Git().
			FetchTags(ctx, remote)
}
@function
async def example(remote: str) -> str:
	return await (
		dag.git()
		.fetch_tags(remote)
	)
@func()
async example(remote: string): Promise<string> {
	return dag
		.git()
		.fetchTags(remote)
}

getChangedDirs() 🔗

Return unique changed directories between two refs.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !-Head Git ref or SHA
paths[String ! ] nullOptional path filters relative to the repository root
depthInteger !1Directory depth to return
diffFilterString !"ACMRTUXB"Git diff-filter status letters
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 get-changed-dirs --base-ref string --head-ref string --depth integer --diff-filter string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string, depth int, diffFilter string) []string  {
	return dag.
			Git().
			GetChangedDirs(ctx, baseRef, headRef, depth, diffFilter)
}
@function
async def example(base_ref: str, head_ref: str, depth: int, diff_filter: str) -> List[str]:
	return await (
		dag.git()
		.get_changed_dirs(base_ref, head_ref, depth, diff_filter)
	)
@func()
async example(baseRef: string, headRef: string, depth: number, diffFilter: string): Promise<string[]> {
	return dag
		.git()
		.getChangedDirs(baseRef, headRef, depth, diffFilter)
}

getChangedFiles() 🔗

Return changed file paths between two refs.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !-Head Git ref or SHA
paths[String ! ] nullOptional path filters relative to the repository root
diffFilterString !"ACMRTUXB"Git diff-filter status letters
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 get-changed-files --base-ref string --head-ref string --diff-filter string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string, diffFilter string) []string  {
	return dag.
			Git().
			GetChangedFiles(ctx, baseRef, headRef, diffFilter)
}
@function
async def example(base_ref: str, head_ref: str, diff_filter: str) -> List[str]:
	return await (
		dag.git()
		.get_changed_files(base_ref, head_ref, diff_filter)
	)
@func()
async example(baseRef: string, headRef: string, diffFilter: string): Promise<string[]> {
	return dag
		.git()
		.getChangedFiles(baseRef, headRef, diffFilter)
}

getChangedPaths() 🔗

Return changed paths inside diff_path between target_branch and HEAD

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
targetBranchString !"master"Target branch or ref to diff against
diffPathString "."Path to scope the diff (relative to repo root)
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 get-changed-paths --target-branch string
func (m *MyModule) Example(ctx context.Context, targetBranch string) []string  {
	return dag.
			Git().
			GetChangedPaths(ctx, targetBranch)
}
@function
async def example(target_branch: str) -> List[str]:
	return await (
		dag.git()
		.get_changed_paths(target_branch)
	)
@func()
async example(targetBranch: string): Promise<string[]> {
	return dag
		.git()
		.getChangedPaths(targetBranch)
}

getMergeBase() 🔗

Return the merge-base commit shared by two refs.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !-Head Git ref or SHA
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 get-merge-base --base-ref string --head-ref string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string) string  {
	return dag.
			Git().
			GetMergeBase(ctx, baseRef, headRef)
}
@function
async def example(base_ref: str, head_ref: str) -> str:
	return await (
		dag.git()
		.get_merge_base(base_ref, head_ref)
	)
@func()
async example(baseRef: string, headRef: string): Promise<string> {
	return dag
		.git()
		.getMergeBase(baseRef, headRef)
}

getShortCommitSha() 🔗

Return short commit SHA for HEAD

Return Type
String !
Arguments
NameTypeDefault ValueDescription
lengthInteger 8Length of the short SHA
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 get-short-commit-sha
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Git().
			GetShortCommitSha(ctx)
}
@function
async def example() -> str:
	return await (
		dag.git()
		.get_short_commit_sha()
	)
@func()
async example(): Promise<string> {
	return dag
		.git()
		.getShortCommitSha()
}

getTags() 🔗

Return tags in the repository, optionally filtered by glob pattern.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
patternString !"*"Optional tag filter pattern (glob)
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 get-tags --pattern string
func (m *MyModule) Example(ctx context.Context, pattern string) []string  {
	return dag.
			Git().
			GetTags(ctx, pattern)
}
@function
async def example(pattern: str) -> List[str]:
	return await (
		dag.git()
		.get_tags(pattern)
	)
@func()
async example(pattern: string): Promise<string[]> {
	return dag
		.git()
		.getTags(pattern)
}

getTagsPointingAt() 🔗

Fetch tags and return tags that point at a ref.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
refString !"HEAD"Git ref to inspect
remoteString !"origin"Remote name to fetch tags from
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 get-tags-pointing-at --ref string --remote string
func (m *MyModule) Example(ctx context.Context, ref string, remote string) []string  {
	return dag.
			Git().
			GetTagsPointingAt(ctx, ref, remote)
}
@function
async def example(ref: str, remote: str) -> List[str]:
	return await (
		dag.git()
		.get_tags_pointing_at(ref, remote)
	)
@func()
async example(ref: string, remote: string): Promise<string[]> {
	return dag
		.git()
		.getTagsPointingAt(ref, remote)
}

hasChanges() 🔗

Return whether any files changed between two refs.

Return Type
Boolean !
Arguments
NameTypeDefault ValueDescription
baseRefString !-Base Git ref or SHA
headRefString !-Head Git ref or SHA
paths[String ! ] nullOptional path filters relative to the repository root
diffFilterString !"ACMRTUXB"Git diff-filter status letters
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 has-changes --base-ref string --head-ref string --diff-filter string
func (m *MyModule) Example(ctx context.Context, baseRef string, headRef string, diffFilter string) bool  {
	return dag.
			Git().
			HasChanges(ctx, baseRef, headRef, diffFilter)
}
@function
async def example(base_ref: str, head_ref: str, diff_filter: str) -> bool:
	return await (
		dag.git()
		.has_changes(base_ref, head_ref, diff_filter)
	)
@func()
async example(baseRef: string, headRef: string, diffFilter: string): Promise<boolean> {
	return dag
		.git()
		.hasChanges(baseRef, headRef, diffFilter)
}

listTags() 🔗

Compatibility wrapper for get_tags.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
patternString !"*"Optional tag filter pattern (glob)
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 list-tags --pattern string
func (m *MyModule) Example(ctx context.Context, pattern string) []string  {
	return dag.
			Git().
			ListTags(ctx, pattern)
}
@function
async def example(pattern: str) -> List[str]:
	return await (
		dag.git()
		.list_tags(pattern)
	)
@func()
async example(pattern: string): Promise<string[]> {
	return dag
		.git()
		.listTags(pattern)
}

withSshPrivateKey() 🔗

Add ssh private key to container

Return Type
String !
Arguments
NameTypeDefault ValueDescription
sourceFile !-Private key file
Example
dagger -m github.com/riftonix/daggerverse/modules/git@6422503b4d3d6f4a05ceca0030926ff478f1dc06 call \
 with-ssh-private-key --source file:path
func (m *MyModule) Example(ctx context.Context, source *dagger.File) string  {
	return dag.
			Git().
			WithSshPrivateKey(ctx, source)
}
@function
async def example(source: dagger.File) -> str:
	return await (
		dag.git()
		.with_ssh_private_key(source)
	)
@func()
async example(source: File): Promise<string> {
	return dag
		.git()
		.withSshPrivateKey(source)
}