git

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(ctx context.Context, url, dir string, shallow bool) error

Clone runs git clone. When shallow is true, uses --depth 1 --filter=blob:none for a faster, smaller clone (no blob history).

func CountAheadBehind added in v0.1.2

func CountAheadBehind(ctx context.Context, dir string) (behind, ahead int)

CountAheadBehind returns the number of commits the repo is behind/ahead of its upstream tracking branch. Returns 0,0 when no upstream is configured.

func Fetch added in v0.1.3

func Fetch(ctx context.Context, dir string, force bool) error

func IsDirty added in v0.1.1

func IsDirty(ctx context.Context, dir string) bool

IsDirty reports whether the repo has uncommitted changes to tracked files. Untracked files do not count. Returns false when dir is not a git repo.

func IsOffDefault added in v0.1.3

func IsOffDefault(ctx context.Context, dir string) bool

IsOffDefault reports whether the current branch differs from the remote's default branch. Returns false when refs/remotes/origin/HEAD is not set.

func IsRepo

func IsRepo(ctx context.Context, dir string) bool

func Pull

func Pull(ctx context.Context, dir string) error

Types

type RepoStatus

type RepoStatus struct {
	Branch     string
	Remote     string
	Behind     int
	Ahead      int
	Dirty      bool
	Untracked  int
	StashCount int
	OffDefault bool
}

func Status

func Status(ctx context.Context, dir string) (*RepoStatus, error)

type SkipError added in v0.1.1

type SkipError struct{ Reason string }

func (*SkipError) Error added in v0.1.1

func (e *SkipError) Error() string

Jump to

Keyboard shortcuts

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