gitconfig

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gitconfig installs and removes the git aliases that make `git create`, `git co` and friends run git-stack. Everything goes through `git config --global`; the file is never edited as text.

Index

Constants

This section is empty.

Variables

View Source
var DefaultAliases = []Alias{
	{"create", "stack create"},
	{"modify", "stack modify"},
	{"absorb", "stack absorb"},
	{"reorder", "stack reorder"},
	{"move", "stack move"},
	{"fold", "stack fold"},
	{"untrack", "stack untrack"},
	{"rename", "stack rename"},
	{"track", "stack init"},
	{"pop", "stack pop"},
	{"restack", "stack restack"},
	{"submit", "stack submit"},
	{"sync", "stack sync"},
	{"up", "stack up"},
	{"down", "stack down"},
	{"top", "stack top"},
	{"bottom", "stack bottom"},
	{"continue", "stack continue"},
	{"abort", "stack abort"},
	{"pr", "stack pr"},
	{"undo", "stack undo"},
	{"c", "stack create"},
	{"m", "stack modify"},
	{"ab", "stack absorb"},
	{"rs", "stack restack"},
	{"ss", "stack submit"},
	{"u", "stack up"},
	{"d", "stack down"},
	{"t", "stack top"},
	{"b", "stack bottom"},
	{"co", "stack checkout"},
}

DefaultAliases mirrors Graphite's command names and short forms. "checkout" is a git builtin and can never be aliased, hence "co".

Functions

This section is empty.

Types

type Alias

type Alias struct {
	Name string
	// Command is the part after "git ", e.g. "stack submit".
	Command string
}

Alias maps a git alias to a git-stack command.

func (Alias) Value

func (a Alias) Value() string

Value is the alias value written to git config.

type Entry

type Entry struct {
	Alias    Alias
	Status   Status
	Existing string
}

Entry is one alias with its planned status.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager plans and applies alias changes.

func New

func New(g *git.Client) *Manager

New returns a Manager.

func (*Manager) Apply

func (m *Manager) Apply(ctx context.Context, p Plan, force bool) (installed, skipped []string, err error)

Apply writes the aliases in the plan. Conflicts are written only when force is set; builtins and shadowing names are always skipped. Every alias written is recorded in stack.managedAliases. It returns the names installed and the names skipped.

func (*Manager) Managed

func (m *Manager) Managed(ctx context.Context) ([]string, error)

Managed returns the aliases recorded as ours.

func (*Manager) Plan

func (m *Manager) Plan(ctx context.Context, aliases []Alias) (Plan, error)

Plan checks every alias against builtins, installed commands and existing aliases without changing anything.

func (*Manager) Uninstall

func (m *Manager) Uninstall(ctx context.Context) (removed, kept []string, err error)

Uninstall removes every managed alias that still points at git-stack and clears the record. Aliases the user changed since are left alone and reported in kept.

type Plan

type Plan struct {
	Entries []Entry
}

Plan lists what installing the aliases would do.

type Status

type Status int

Status of one alias in a Plan.

const (
	// StatusNew: not set yet.
	StatusNew Status = iota
	// StatusSame: already set to our value.
	StatusSame
	// StatusConflict: set to a different value.
	StatusConflict
	// StatusBuiltin: git would ignore it because a builtin has that name.
	StatusBuiltin
	// StatusShadows: an installed git command has that name.
	StatusShadows
)

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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