Documentation
¶
Index ¶
- Constants
- func DiffTargets(args []string) (base, target string, err error)
- func Paths(files []ChangedFile) []string
- func StatusChar(status string) string
- type ChangedFile
- type CommitInfo
- type Repo
- func (r *Repo) ChangedFiles(staged bool) ([]ChangedFile, error)
- func (r *Repo) CurrentBranch() string
- func (r *Repo) DiffBetweenCommits(baseRef, targetRef string) ([]ChangedFile, error)
- func (r *Repo) ListStashes() ([]StashEntry, error)
- func (r *Repo) Log(ref string, maxCount int, paths []string) ([]CommitInfo, error)
- func (r *Repo) LogAll(maxCount int, paths []string) ([]CommitInfo, error)
- func (r *Repo) Root() string
- func (r *Repo) Stage(paths ...string) error
- func (r *Repo) StageHunk(patch string) error
- func (r *Repo) StatusFiles() ([]StatusFile, error)
- func (r *Repo) Unstage(paths ...string) error
- func (r *Repo) UnstageHunk(patch string) error
- type StashEntry
- type StatusFile
Constants ¶
View Source
const EmptyTree = "4b825dc642cb6eb9a060e54bf899d69f82cf7207"
EmptyTree is git's well-known empty-tree object, used as the base when diffing a root commit (which has no parent).
Variables ¶
This section is empty.
Functions ¶
func DiffTargets ¶
func Paths ¶ added in v0.3.0
func Paths(files []ChangedFile) []string
Paths returns just the paths of the changed files.
func StatusChar ¶
Types ¶
type ChangedFile ¶
type ChangedFile struct {
Path string `json:"path"`
Status string `json:"status"`
Added int `json:"added"`
Deleted int `json:"deleted"`
}
func FilterByPaths ¶
func FilterByPaths(files []ChangedFile, paths []string) []ChangedFile
type CommitInfo ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func (*Repo) ChangedFiles ¶
func (r *Repo) ChangedFiles(staged bool) ([]ChangedFile, error)
func (*Repo) CurrentBranch ¶ added in v0.3.1
CurrentBranch returns the checked-out branch name, the short commit hash when HEAD is detached, or "" if it can't be determined. go-git can't resolve HEAD in linked worktrees (go-git#1842), so those (and any go-git failure) shell out.
func (*Repo) DiffBetweenCommits ¶
func (r *Repo) DiffBetweenCommits(baseRef, targetRef string) ([]ChangedFile, error)
func (*Repo) ListStashes ¶
func (r *Repo) ListStashes() ([]StashEntry, error)
func (*Repo) StatusFiles ¶
func (r *Repo) StatusFiles() ([]StatusFile, error)
func (*Repo) UnstageHunk ¶
type StashEntry ¶
type StatusFile ¶
Click to show internal directories.
Click to hide internal directories.