git

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package git provides infrastructure adapters for git operations.

Index

Constants

View Source
const (
	// DefaultLocalTimeout is the timeout for local git operations (read-only).
	DefaultLocalTimeout = 30 * time.Second

	// DefaultRemoteTimeout is the timeout for remote git operations (network calls).
	DefaultRemoteTimeout = 60 * time.Second
)

Default timeouts for git operations to prevent hangs on slow/unreachable remotes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter adapts the existing git service to the domain interface.

func NewAdapter

func NewAdapter(svc gitservice.Service) *Adapter

NewAdapter creates a new git adapter.

func (*Adapter) CreateTag

func (a *Adapter) CreateTag(ctx context.Context, name string, hash sourcecontrol.CommitHash, message string) (*sourcecontrol.Tag, error)

CreateTag creates a new tag.

func (*Adapter) DeleteTag

func (a *Adapter) DeleteTag(ctx context.Context, name string) error

DeleteTag deletes a tag.

func (*Adapter) Fetch

func (a *Adapter) Fetch(ctx context.Context, remote string) error

Fetch fetches from a remote.

func (*Adapter) GetBranches

func (a *Adapter) GetBranches(ctx context.Context) ([]sourcecontrol.BranchInfo, error)

GetBranches retrieves branch information.

func (*Adapter) GetCommit

GetCommit retrieves a specific commit.

func (*Adapter) GetCommitsBetween

func (a *Adapter) GetCommitsBetween(ctx context.Context, from, to string) ([]*sourcecontrol.Commit, error)

GetCommitsBetween retrieves commits between two references.

func (*Adapter) GetCommitsSince

func (a *Adapter) GetCommitsSince(ctx context.Context, ref string) ([]*sourcecontrol.Commit, error)

GetCommitsSince retrieves commits since a reference.

func (*Adapter) GetCurrentBranch

func (a *Adapter) GetCurrentBranch(ctx context.Context) (string, error)

GetCurrentBranch retrieves the current branch name.

func (*Adapter) GetInfo

GetInfo retrieves repository information.

func (*Adapter) GetLatestCommit

func (a *Adapter) GetLatestCommit(ctx context.Context, branch string) (*sourcecontrol.Commit, error)

GetLatestCommit retrieves the latest commit on a branch.

func (*Adapter) GetLatestVersionTag

func (a *Adapter) GetLatestVersionTag(ctx context.Context, prefix string) (*sourcecontrol.Tag, error)

GetLatestVersionTag retrieves the latest version tag.

func (*Adapter) GetRemotes

func (a *Adapter) GetRemotes(ctx context.Context) ([]sourcecontrol.RemoteInfo, error)

GetRemotes retrieves remote information.

func (*Adapter) GetStatus

GetStatus retrieves the working tree status.

func (*Adapter) GetTag

func (a *Adapter) GetTag(ctx context.Context, name string) (*sourcecontrol.Tag, error)

GetTag retrieves a specific tag.

func (*Adapter) GetTags

func (a *Adapter) GetTags(ctx context.Context) (sourcecontrol.TagList, error)

GetTags retrieves all tags.

func (*Adapter) IsDirty

func (a *Adapter) IsDirty(ctx context.Context) (bool, error)

IsDirty checks if the working tree is dirty.

func (*Adapter) Pull

func (a *Adapter) Pull(ctx context.Context, remote, branch string) error

Pull pulls from a remote.

func (*Adapter) Push

func (a *Adapter) Push(ctx context.Context, remote, branch string) error

Push pushes to a remote.

func (*Adapter) PushTag

func (a *Adapter) PushTag(ctx context.Context, name string, remote string) error

PushTag pushes a tag to a remote.

Jump to

Keyboard shortcuts

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