git

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentBranch

func CurrentBranch(dir string) string

CurrentBranch returns the current branch name when dir is the root of a Git repository. Returns empty string if dir is not a repo, git is unavailable, or on error.

Types

type ChangeStatus

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

type ChangedFile

type ChangedFile struct {
	Path      string       `json:"path"`
	OldPath   string       `json:"old_path,omitempty"`
	Status    ChangeStatus `json:"status"`
	Additions int          `json:"additions"`
	Deletions int          `json:"deletions"`
	Patch     string       `json:"patch,omitempty"`
	Binary    bool         `json:"binary,omitempty"`
	Truncated bool         `json:"truncated,omitempty"`
}

type WorkspaceDiff

type WorkspaceDiff struct {
	Workspace string        `json:"workspace"`
	Files     []ChangedFile `json:"files"`
	Error     string        `json:"error,omitempty"`
}

func ReadWorkspace

func ReadWorkspace(ctx context.Context, workspace string) (WorkspaceDiff, error)

Jump to

Keyboard shortcuts

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