git

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FetchTTL = 5 * time.Minute

Functions

func Branch added in v0.4.0

func Branch(dir string) (string, error)

func Clone

func Clone(url, dir string) error

func DefaultBranch added in v0.4.0

func DefaultBranch(dir string) (string, error)

func Installed

func Installed(dir string) (bool, error)

func Pull

func Pull(dir, branch string) error

func RemoteSlug added in v0.4.0

func RemoteSlug(dir string) (org, name string, err error)

func ShowBlob added in v0.4.0

func ShowBlob(dir, ref, path string) ([]byte, error)

func ShowFile added in v0.4.0

func ShowFile(dir, ref, path string) ([]string, error)

Types

type Commit added in v0.4.0

type Commit struct {
	Author  string
	Date    time.Time
	SHA     string
	Subject string
}

func CommitLog added in v0.4.0

func CommitLog(dir, base, head string) ([]Commit, error)

func HunkCommit added in v0.4.0

func HunkCommit(dir, base, head, path string, newStart, newCount int) (Commit, error)

func LastCommit added in v0.4.0

func LastCommit(dir string) (Commit, error)

func ShowCommit added in v0.4.0

func ShowCommit(dir, sha string) (Commit, error)

type File added in v0.4.0

type File struct {
	Binary  bool
	Hunks   []Hunk
	NewPath string
	OldPath string
	Status  FileStatus
}

func Diff added in v0.4.0

func Diff(dir, base, head string) ([]File, error)

func DiffCommit added in v0.4.0

func DiffCommit(dir, sha string) ([]File, error)

func ParseDiff added in v0.4.0

func ParseDiff(raw string) ([]File, error)

func (File) Adds added in v0.4.0

func (f File) Adds() int

func (File) Dels added in v0.4.0

func (f File) Dels() int

func (File) Path added in v0.4.0

func (f File) Path() string

type FileStatus added in v0.4.0

type FileStatus string
const (
	StatusAdded    FileStatus = "added"
	StatusDeleted  FileStatus = "deleted"
	StatusModified FileStatus = "modified"
	StatusRenamed  FileStatus = "renamed"
)

type Hunk added in v0.4.0

type Hunk struct {
	Header   string
	Lines    []Line
	NewCount int
	NewStart int
	OldCount int
	OldStart int
	Section  string
}

func (Hunk) Adds added in v0.4.0

func (h Hunk) Adds() int

func (Hunk) Dels added in v0.4.0

func (h Hunk) Dels() int

func (Hunk) Key added in v0.4.0

func (h Hunk) Key() string

type Line added in v0.4.0

type Line struct {
	Content string
	Kind    LineKind
	NewLine int
	OldLine int
}

type LineKind added in v0.4.0

type LineKind string
const (
	LineAdd     LineKind = "add"
	LineContext LineKind = "context"
	LineDelete  LineKind = "delete"
)

type State

type State struct {
	Behind    int
	Diverged  bool
	Dirty     bool
	Installed bool
}

func ComputeStatus

func ComputeStatus(dir, branch string) (State, error)

func Status

func Status(dir, branch string) (State, error)

Jump to

Keyboard shortcuts

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