Documentation
¶
Index ¶
- Constants
- func IsHeadCommit(commits []*Commit, index int) bool
- func SetStatusFields(file *File, shortStatus string)
- type Author
- type Branch
- func (b *Branch) Description() string
- func (b *Branch) FullRefName() string
- func (b *Branch) FullUpstreamRefName() string
- func (b *Branch) ID() string
- func (b *Branch) IsAheadForPull() bool
- func (b *Branch) IsBehindForPull() bool
- func (b *Branch) IsBehindForPush() bool
- func (b *Branch) IsRealBranch() bool
- func (b *Branch) IsTrackingRemote() bool
- func (b *Branch) MatchesUpstream() bool
- func (b *Branch) ParentRefName() string
- func (b *Branch) RefName() string
- func (b *Branch) RemoteBranchNotStoredLocally() bool
- func (b *Branch) RemoteBranchStoredLocally() bool
- func (b *Branch) ShortRefName() string
- func (b *Branch) ShortUpstreamRefName() string
- func (b *Branch) URN() string
- type Commit
- func (c *Commit) Description() string
- func (c *Commit) FullRefName() string
- func (c *Commit) ID() string
- func (c *Commit) IsFirstCommit() bool
- func (c *Commit) IsMerge() bool
- func (c *Commit) IsTODO() bool
- func (c *Commit) ParentRefName() string
- func (c *Commit) RefName() string
- func (c *Commit) ShortHash() string
- func (c *Commit) ShortRefName() string
- type CommitFile
- type CommitStatus
- type Divergence
- type File
- func (f *File) Description() string
- func (f *File) GetHasStagedChanges() bool
- func (f *File) GetHasUnstagedChanges() bool
- func (f *File) GetIsFile() bool
- func (f *File) GetIsTracked() bool
- func (f *File) GetPath() string
- func (f *File) GetPreviousPath() string
- func (f *File) ID() string
- func (f *File) IsRename() bool
- func (f *File) IsSubmodule(configs []*SubmoduleConfig) bool
- func (f *File) Matches(f2 *File) bool
- func (f *File) Names() []string
- func (f *File) SubmoduleConfig(configs []*SubmoduleConfig) *SubmoduleConfig
- type IFile
- type Remote
- type RemoteBranch
- type StashEntry
- type StatusFields
- type SubmoduleConfig
- type Tag
- type Worktree
Constants ¶
const ( // Conveniently for us, the todo package starts the enum at 1, and given // that it doesn't have a "none" value, we're setting ours to 0 ActionNone todo.TodoCommand = 0 // "Comment" is the last one of the todo package's enum entries ActionConflict = todo.Comment + 1 )
const EmptyTreeCommitHash = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
Special commit hash for empty tree object
Variables ¶
This section is empty.
Functions ¶
func IsHeadCommit ¶ added in v0.38.0
func SetStatusFields ¶ added in v0.36.0
Types ¶
type Branch ¶
type Branch struct {
Name string
// the displayname is something like '(HEAD detached at 123asdf)', whereas in that case the name would be '123asdf'
DisplayName string
// indicator of when the branch was last checked out e.g. '2d', '3m'
Recency string
// how many commits ahead we are from the remote branch (how many commits we can push, assuming we push to our tracked remote branch)
AheadForPull string
// how many commits behind we are from the remote branch (how many commits we can pull)
BehindForPull string
// how many commits ahead we are from the branch we're pushing to (which might not be the same as our upstream branch in a triangular workflow)
AheadForPush string
// how many commits behind we are from the branch we're pushing to (which might not be the same as our upstream branch in a triangular workflow)
BehindForPush string
// whether the remote branch is 'gone' i.e. we're tracking a remote branch that has been deleted
UpstreamGone bool
// whether this is the current branch. Exactly one branch should have this be true
Head bool
DetachedHead bool
// if we have a named remote locally this will be the name of that remote e.g.
// 'origin' or 'tiwood'. If we don't have the remote locally it'll look like
// 'git@github.com:tiwood/lazygit.git'
UpstreamRemote string
UpstreamBranch string
// subject line in commit message
Subject string
// commit hash
CommitHash string
// How far we have fallen behind our base branch. 0 means either not
// determined yet, or up to date with base branch. (We don't need to
// distinguish the two, as we don't draw anything in both cases.)
BehindBaseBranch atomic.Int32
}
Branch : A git branch duplicating this for now
func (*Branch) Description ¶
func (*Branch) FullRefName ¶ added in v0.35.0
func (*Branch) FullUpstreamRefName ¶ added in v0.41.0
func (*Branch) IsAheadForPull ¶ added in v0.42.0
func (*Branch) IsBehindForPull ¶ added in v0.42.0
func (*Branch) IsBehindForPush ¶ added in v0.42.0
func (*Branch) IsRealBranch ¶ added in v0.30.1
for when we're in a detached head state
func (*Branch) IsTrackingRemote ¶ added in v0.30.1
func (*Branch) MatchesUpstream ¶ added in v0.30.1
func (*Branch) ParentRefName ¶ added in v0.35.0
func (*Branch) RemoteBranchNotStoredLocally ¶ added in v0.35.0
func (*Branch) RemoteBranchStoredLocally ¶ added in v0.32.2
we know that the remote branch is not stored locally based on our pushable/pullable count being question marks.
func (*Branch) ShortRefName ¶ added in v0.44.0
func (*Branch) ShortUpstreamRefName ¶ added in v0.41.0
type Commit ¶
type Commit struct {
Hash string
Name string
Status CommitStatus
Action todo.TodoCommand
Tags []string
ExtraInfo string // something like 'HEAD -> master, tag: v0.15.2'
AuthorName string // something like 'Jesse Duffield'
AuthorEmail string // something like 'jessedduffield@gmail.com'
UnixTimestamp int64
Divergence Divergence // set to DivergenceNone unless we are showing the divergence view
// Hashes of parent commits (will be multiple if it's a merge commit)
Parents []string
}
Commit : A git commit
func (*Commit) Description ¶
func (*Commit) FullRefName ¶ added in v0.35.0
func (*Commit) IsFirstCommit ¶ added in v0.35.0
func (*Commit) IsTODO ¶ added in v0.35.0
returns true if this commit is not actually in the git log but instead is from a TODO file for an interactive rebase.
func (*Commit) ParentRefName ¶ added in v0.35.0
func (*Commit) ShortRefName ¶ added in v0.44.0
type CommitFile ¶
type CommitFile struct {
// TODO: rename this to Path
Name string
ChangeStatus string // e.g. 'A' for added or 'M' for modified. This is based on the result from git diff --name-status
}
CommitFile : A git commit file
func (*CommitFile) Added ¶ added in v0.39.0
func (f *CommitFile) Added() bool
func (*CommitFile) Deleted ¶ added in v0.39.0
func (f *CommitFile) Deleted() bool
func (*CommitFile) Description ¶
func (f *CommitFile) Description() string
func (*CommitFile) GetPath ¶ added in v0.39.0
func (f *CommitFile) GetPath() string
func (*CommitFile) ID ¶
func (f *CommitFile) ID() string
type CommitStatus ¶ added in v0.38.0
type CommitStatus int
const ( StatusNone CommitStatus = iota StatusUnpushed StatusPushed StatusMerged StatusRebasing StatusSelected StatusReflog )
type Divergence ¶ added in v0.41.0
type Divergence int
const ( DivergenceNone Divergence = iota DivergenceLeft DivergenceRight )
For a divergence log (left/right comparison of two refs) this is set to either DivergenceLeft or DivergenceRight for each commit; for normal commit views it is always DivergenceNone.
type File ¶
type File struct {
Name string
PreviousName string
HasStagedChanges bool
HasUnstagedChanges bool
Tracked bool
Added bool
Deleted bool
HasMergeConflicts bool
HasInlineMergeConflicts bool
DisplayString string
ShortStatus string // e.g. 'AD', ' A', 'M ', '??'
// If true, this must be a worktree folder
IsWorktree bool
}
File : A file from git status duplicating this for now
func (*File) Description ¶
func (*File) GetHasStagedChanges ¶ added in v0.27.1
func (*File) GetHasUnstagedChanges ¶ added in v0.27.1
func (*File) GetIsTracked ¶ added in v0.27.1
func (*File) GetPreviousPath ¶ added in v0.35.0
func (*File) IsSubmodule ¶
func (f *File) IsSubmodule(configs []*SubmoduleConfig) bool
func (*File) Matches ¶
returns true if the file names are the same or if a file rename includes the filename of the other
func (*File) Names ¶
Names returns an array containing just the filename, or in the case of a rename, the after filename and the before filename
func (*File) SubmoduleConfig ¶
func (f *File) SubmoduleConfig(configs []*SubmoduleConfig) *SubmoduleConfig
type IFile ¶ added in v0.27.1
type IFile interface {
GetHasUnstagedChanges() bool
GetHasStagedChanges() bool
GetIsTracked() bool
GetPath() string
GetPreviousPath() string
GetIsFile() bool
}
sometimes we need to deal with either a node (which contains a file) or an actual file
type Remote ¶
type Remote struct {
Name string
Urls []string
Branches []*RemoteBranch
}
Remote : A git remote
func (*Remote) Description ¶
type RemoteBranch ¶
Remote Branch : A git remote branch
func (*RemoteBranch) Description ¶
func (r *RemoteBranch) Description() string
func (*RemoteBranch) FullName ¶
func (r *RemoteBranch) FullName() string
func (*RemoteBranch) FullRefName ¶ added in v0.35.0
func (r *RemoteBranch) FullRefName() string
func (*RemoteBranch) ID ¶
func (r *RemoteBranch) ID() string
func (*RemoteBranch) ParentRefName ¶ added in v0.35.0
func (r *RemoteBranch) ParentRefName() string
func (*RemoteBranch) RefName ¶
func (r *RemoteBranch) RefName() string
func (*RemoteBranch) ShortRefName ¶ added in v0.44.0
func (r *RemoteBranch) ShortRefName() string
type StashEntry ¶
StashEntry : A git stash entry
func (*StashEntry) Description ¶
func (s *StashEntry) Description() string
func (*StashEntry) FullRefName ¶ added in v0.35.0
func (s *StashEntry) FullRefName() string
func (*StashEntry) ID ¶
func (s *StashEntry) ID() string
func (*StashEntry) ParentRefName ¶ added in v0.35.0
func (s *StashEntry) ParentRefName() string
func (*StashEntry) RefName ¶
func (s *StashEntry) RefName() string
func (*StashEntry) ShortRefName ¶ added in v0.44.0
func (s *StashEntry) ShortRefName() string
type StatusFields ¶ added in v0.36.0
type SubmoduleConfig ¶
type SubmoduleConfig struct {
Name string
Path string
Url string
ParentModule *SubmoduleConfig // nil if top-level
}
func (*SubmoduleConfig) Description ¶
func (r *SubmoduleConfig) Description() string
func (*SubmoduleConfig) FullName ¶ added in v0.41.0
func (r *SubmoduleConfig) FullName() string
func (*SubmoduleConfig) FullPath ¶ added in v0.41.0
func (r *SubmoduleConfig) FullPath() string
func (*SubmoduleConfig) GitDirPath ¶ added in v0.41.0
func (r *SubmoduleConfig) GitDirPath(repoGitDirPath string) string
func (*SubmoduleConfig) ID ¶
func (r *SubmoduleConfig) ID() string
func (*SubmoduleConfig) RefName ¶
func (r *SubmoduleConfig) RefName() string
type Tag ¶
type Tag struct {
Name string
// this is either the first line of the message of an annotated tag, or the
// first line of a commit message for a lightweight tag
Message string
}
Tag : A git tag
func (*Tag) Description ¶
func (*Tag) FullRefName ¶ added in v0.35.0
func (*Tag) ParentRefName ¶ added in v0.35.0
func (*Tag) ShortRefName ¶ added in v0.44.0
type Worktree ¶ added in v0.40.0
type Worktree struct {
// if false, this is a linked worktree
IsMain bool
// if true, this is the worktree that is currently checked out
IsCurrent bool
// path to the directory of the worktree i.e. the directory that contains all the user's files
Path string
// if true, the path is not found
IsPathMissing bool
// path of the git directory for this worktree. The equivalent of the .git directory
// in the main worktree. For linked worktrees this would be <repo_path>/.git/worktrees/<name>
GitDir string
// If the worktree has a branch checked out, this field will be set to the branch name.
// A branch is considered 'checked out' if:
// * the worktree is directly on the branch
// * the worktree is mid-rebase on the branch
// * the worktree is mid-bisect on the branch
Branch string
// based on the path, but uniquified. Not the same name that git uses in the worktrees/ folder (no good reason for this,
// I just prefer my naming convention better)
Name string
}
A git worktree