Documentation
¶
Index ¶
Constants ¶
const ( CustomCommandUndo = "undo" CustomCommandBack = "back" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BehaviorType ¶ added in v0.2.0
type BehaviorType int
BehaviorType describes how a git command behaves in terms of state changes and logging.
const ( UnknownBehavior BehaviorType = iota // Mutating commands create or modify repository state and can be undone with git-undo. Mutating Navigating // ReadOnly commands just read information and should not be logged. ReadOnly )
func (BehaviorType) String ¶ added in v0.2.0
func (bt BehaviorType) String() string
type CommandType ¶
type CommandType int
CommandType is the type of a git command.
const ( UnknownCommand CommandType = iota Porcelain Plumbing Custom )
func (CommandType) String ¶
func (ct CommandType) String() string
type GitCommand ¶
type GitCommand struct { Name string // e.g. "branch" Args []string // flags and operands Supported bool // was Name in our lookup? Type CommandType // Porcelain, Plumbing, or Unknown BehaviorType BehaviorType // Mutating, Navigating, or ReadOnly }
GitCommand represents a parsed "git …" invocation.
func ParseGitCommand ¶
func ParseGitCommand(raw string) (*GitCommand, error)
ParseGitCommand parses a git command string into a GitCommand struct.
func (*GitCommand) IsMutating ¶ added in v0.2.0
func (c *GitCommand) IsMutating() bool
IsMutating returns true if the command mutates repository state.
func (*GitCommand) IsNavigating ¶ added in v0.2.0
func (c *GitCommand) IsNavigating() bool
IsNavigating returns true if the command navigates between states.
func (*GitCommand) IsReadOnly ¶
func (c *GitCommand) IsReadOnly() bool
IsReadOnly returns true if the command is read-only (for backward compatibility).
func (*GitCommand) Normalize ¶ added in v0.2.0
func (c *GitCommand) Normalize() (*GitCommand, error)
Normalize normalizes the command to a canonical form.
func (*GitCommand) NormalizedString ¶ added in v0.2.0
func (c *GitCommand) NormalizedString() (string, error)
NormalizedString returns the normalized command as a string.
func (*GitCommand) String ¶ added in v0.2.0
func (c *GitCommand) String() string
String returns a human-readable representation of the command.
type H ¶
type H struct {
// contains filtered or unexported fields
}
H is the struct for wrapping git helper functions It holds repoDir where commands are executed.
func NewGitHelper ¶
NewGitHelper creates a new GitHelper instance.
func (*H) GetCurrentGitRef ¶
GetCurrentGitRef returns the current ref (branch, tag, commit hash) in the repository.
func (*H) GetRepoGitDir ¶
GetRepoGitDir returns the path to the .git directory of current repository.