git

package
v1.222.0-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Overview

Package git implements the `atmos git` command group, providing Git repository operations (clone, pull, status, diff, commit, push) through the shared pkg/git service and provider registry.

All commands follow the command registry pattern (CommandProvider interface) and use flags.NewStandardParser() for flag handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsURI

func IsURI(s string) bool

IsURI reports whether s looks like a Git URI:

  • has git:: forcing prefix
  • starts with https:// or http://
  • starts with git@... (SCP-style)
  • starts with ssh://
  • starts with git://

func SetAtmosConfig

func SetAtmosConfig(config *schema.AtmosConfiguration)

SetAtmosConfig is called from root.go after atmosConfig is initialized, making the configuration available to all git subcommands.

Types

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor holds the resolved inputs for a single Git operation and delegates to an injected Provider. This enables unit testing without invoking real git subprocesses: tests pass a stub provider; production passes the real one.

func (*Executor) Clone

func (e *Executor) Clone(ctx context.Context, opts *atmosgit.CloneOptions, label string) error

Clone delegates to the provider.

func (*Executor) CloneWithoutSpinner

func (e *Executor) CloneWithoutSpinner(ctx context.Context, opts *atmosgit.CloneOptions, label string) error

func (*Executor) Commit

Commit delegates to the provider.

func (*Executor) Diff

Diff delegates to the provider.

func (*Executor) Init

func (e *Executor) Init(ctx context.Context, opts *atmosgit.InitOptions, label string) error

Init delegates to the provider.

func (*Executor) Pull

func (e *Executor) Pull(ctx context.Context, opts *atmosgit.PullOptions) error

Pull delegates to the provider.

func (*Executor) Push

func (e *Executor) Push(ctx context.Context, opts *atmosgit.PushOptions) error

Push delegates to the provider.

func (*Executor) Status

Status delegates to the provider and prints the result.

type GitCommandProvider

type GitCommandProvider struct{}

GitCommandProvider implements the CommandProvider interface for `atmos git`.

func (*GitCommandProvider) GetAliases

func (g *GitCommandProvider) GetAliases() []internal.CommandAlias

GetAliases returns command aliases for git subcommands. Registers "atmos list git-repositories" as an alias for "atmos git list", following the same pattern as "atmos workflow list" ↔ "atmos list workflows".

func (*GitCommandProvider) GetCommand

func (g *GitCommandProvider) GetCommand() *cobra.Command

GetCommand returns the git parent command (with all subcommands attached).

func (*GitCommandProvider) GetCompatibilityFlags

func (g *GitCommandProvider) GetCompatibilityFlags() map[string]compat.CompatibilityFlag

GetCompatibilityFlags returns compatibility flags for this command. The git command group has no compatibility flags.

func (*GitCommandProvider) GetFlagsBuilder

func (g *GitCommandProvider) GetFlagsBuilder() flags.Builder

GetFlagsBuilder returns the flags builder for this command. The parent git command has no flags of its own.

func (*GitCommandProvider) GetGroup

func (g *GitCommandProvider) GetGroup() string

GetGroup returns the command group for help organization.

func (*GitCommandProvider) GetName

func (g *GitCommandProvider) GetName() string

GetName returns the command name.

func (*GitCommandProvider) GetPositionalArgsBuilder

func (g *GitCommandProvider) GetPositionalArgsBuilder() *flags.PositionalArgsBuilder

GetPositionalArgsBuilder returns the positional args builder for this command. The parent git command has no positional arguments.

func (*GitCommandProvider) IsExperimental

func (g *GitCommandProvider) IsExperimental() bool

IsExperimental returns whether this command is experimental.

type GitListOptions

type GitListOptions struct {
	global.Flags
	Columns     []string
	Format      string
	Delimiter   string
	CheckStatus bool
}

GitListOptions holds parsed options for `atmos git list`.

type ParsedURI

type ParsedURI struct {
	// URI is the clean remote URI (without git:: prefix and without query params).
	URI string
	// Branch is the parsed branch/ref from ?ref=, or empty.
	Branch string
	// Depth is the parsed clone depth from ?depth=, or 0 for full history.
	Depth int
	// RepoName is the last path component without .git suffix, used as the
	// clone directory name for ad hoc URI clones.
	RepoName string
}

ParsedURI is the result of parsing a clone URI argument.

func ParseCloneURI

func ParseCloneURI(raw string) (*ParsedURI, error)

ParseCloneURI parses a clone URI argument, stripping the git:: prefix and extracting ?ref= and ?depth= query parameters (precedence: flags > query params > config). Unknown query parameters return an error.

type StatusProber

type StatusProber interface {
	ProbeStatus(ctx context.Context, workdir string) string
}

StatusProber is a seam for status probing used in tests. Production code uses the git provider; tests substitute a stub.

Directories

Path Synopsis
Package hooks implements the `atmos git hooks` command group: thin cobra wiring over pkg/git/hooks, which owns the shim install/run/uninstall logic.
Package hooks implements the `atmos git hooks` command group: thin cobra wiring over pkg/git/hooks, which owns the shim install/run/uninstall logic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL