Help us shape the future of Go! Take the 2026 Go Developer Survey

gitx

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeout = 60 * time.Second

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) int

func HunkHeader

func HunkHeader(h *diff.Hunk) string

func Version

func Version() (string, error)

Types

type Error

type Error struct {
	Args     []string
	Stderr   string
	ExitCode int
	Err      error
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type FilePatch

type FilePatch struct {
	Path     string
	OldPath  string
	Binary   bool
	OldMode  string
	NewMode  string
	Deleted  bool
	Created  bool
	Hunks    []*diff.Hunk
	Text     string
	Added    int
	Removed  int
	Extended []string
}

func ParsePatch

func ParsePatch(out []byte) ([]FilePatch, error)

ParsePatch parses `git diff` output with go-diff and adds the details that go-diff leaves in the extended headers (binary files, modes, renames).

type Git

type Git struct {
	Dir     string
	Env     []string
	Timeout time.Duration
	Stdin   io.Reader
}

func In

func In(dir string) Git

func (Git) Output

func (g Git) Output(args ...string) ([]byte, error)

func (Git) Run

func (g Git) Run(args ...string) (string, error)

func (Git) With

func (g Git) With(env ...string) Git

func (Git) WithStdin

func (g Git) WithStdin(r io.Reader) Git

type Line

type Line struct {
	Kind    byte
	Text    string
	OldLine int
	NewLine int
}

func HunkLines

func HunkLines(h *diff.Hunk) []Line

type RawChange

type RawChange struct {
	Status  byte
	OldMode string
	NewMode string
	OldBlob string
	NewBlob string
	OldPath string
	Path    string
}

func ParseRaw

func ParseRaw(out []byte) ([]RawChange, error)

ParseRaw parses the output of `git diff --raw -z --no-abbrev`.

Jump to

Keyboard shortcuts

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