models

package
v0.0.0-...-00ab8b8 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const EmptyTreeCommitHash = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"

Special commit hash for empty tree object

Variables

This section is empty.

Functions

func IsHeadCommit

func IsHeadCommit(commits []*Commit, index int) bool

func SetStatusFields

func SetStatusFields(file *File, shortStatus string)

Types

type Author

type Author struct {
	Name  string
	Email string
}

A commit author

func (*Author) Combined

func (self *Author) Combined() string

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)
	Pushables string
	// how many commits behind we are from the remote branch (how many commits we can pull)
	Pullables 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
}

Branch : A git branch duplicating this for now

func (*Branch) Description

func (b *Branch) Description() string

func (*Branch) FullRefName

func (b *Branch) FullRefName() string

func (*Branch) FullUpstreamRefName

func (b *Branch) FullUpstreamRefName() string

func (*Branch) HasCommitsToPull

func (b *Branch) HasCommitsToPull() bool

func (*Branch) HasCommitsToPush

func (b *Branch) HasCommitsToPush() bool

func (*Branch) ID

func (b *Branch) ID() string

func (*Branch) IsRealBranch

func (b *Branch) IsRealBranch() bool

for when we're in a detached head state

func (*Branch) IsTrackingRemote

func (b *Branch) IsTrackingRemote() bool

func (*Branch) MatchesUpstream

func (b *Branch) MatchesUpstream() bool

func (*Branch) ParentRefName

func (b *Branch) ParentRefName() string

func (*Branch) RefName

func (b *Branch) RefName() string

func (*Branch) RemoteBranchNotStoredLocally

func (b *Branch) RemoteBranchNotStoredLocally() bool

func (*Branch) RemoteBranchStoredLocally

func (b *Branch) RemoteBranchStoredLocally() bool

we know that the remote branch is not stored locally based on our pushable/pullable count being question marks.

func (*Branch) ShortUpstreamRefName

func (b *Branch) ShortUpstreamRefName() string

func (*Branch) URN

func (b *Branch) URN() string

type Commit

type Commit struct {
	Sha           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

	// SHAs of parent commits (will be multiple if it's a merge commit)
	Parents []string
}

Commit : A git commit

func (*Commit) Description

func (c *Commit) Description() string

func (*Commit) FullRefName

func (c *Commit) FullRefName() string

func (*Commit) ID

func (c *Commit) ID() string

func (*Commit) IsFirstCommit

func (c *Commit) IsFirstCommit() bool

func (*Commit) IsMerge

func (c *Commit) IsMerge() bool

func (*Commit) IsTODO

func (c *Commit) IsTODO() bool

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

func (c *Commit) ParentRefName() string

func (*Commit) RefName

func (c *Commit) RefName() string

func (*Commit) ShortSha

func (c *Commit) ShortSha() string

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

func (f *CommitFile) Added() bool

func (*CommitFile) Deleted

func (f *CommitFile) Deleted() bool

func (*CommitFile) Description

func (f *CommitFile) Description() string

func (*CommitFile) GetPath

func (f *CommitFile) GetPath() string

func (*CommitFile) ID

func (f *CommitFile) ID() string

type CommitStatus

type CommitStatus int
const (
	StatusNone CommitStatus = iota
	StatusUnpushed
	StatusPushed
	StatusMerged
	StatusRebasing
	StatusSelected
	StatusReflog
)

type Divergence

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 (f *File) Description() string

func (*File) GetHasStagedChanges

func (f *File) GetHasStagedChanges() bool

func (*File) GetHasUnstagedChanges

func (f *File) GetHasUnstagedChanges() bool

func (*File) GetIsFile

func (f *File) GetIsFile() bool

func (*File) GetIsTracked

func (f *File) GetIsTracked() bool

func (*File) GetPath

func (f *File) GetPath() string

func (*File) GetPreviousPath

func (f *File) GetPreviousPath() string

func (*File) ID

func (f *File) ID() string

func (*File) IsRename

func (f *File) IsRename() bool

func (*File) IsSubmodule

func (f *File) IsSubmodule(configs []*SubmoduleConfig) bool

func (*File) Matches

func (f *File) Matches(f2 *File) bool

returns true if the file names are the same or if a file rename includes the filename of the other

func (*File) Names

func (f *File) Names() []string

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

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

func (r *Remote) Description() string

func (*Remote) ID

func (r *Remote) ID() string

func (*Remote) RefName

func (r *Remote) RefName() string

func (*Remote) URN

func (r *Remote) URN() string

type RemoteBranch

type RemoteBranch struct {
	Name       string
	RemoteName string
}

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

func (r *RemoteBranch) FullRefName() string

func (*RemoteBranch) ID

func (r *RemoteBranch) ID() string

func (*RemoteBranch) ParentRefName

func (r *RemoteBranch) ParentRefName() string

func (*RemoteBranch) RefName

func (r *RemoteBranch) RefName() string

type StashEntry

type StashEntry struct {
	Index   int
	Recency string
	Name    string
}

StashEntry : A git stash entry

func (*StashEntry) Description

func (s *StashEntry) Description() string

func (*StashEntry) FullRefName

func (s *StashEntry) FullRefName() string

func (*StashEntry) ID

func (s *StashEntry) ID() string

func (*StashEntry) ParentRefName

func (s *StashEntry) ParentRefName() string

func (*StashEntry) RefName

func (s *StashEntry) RefName() string

type StatusFields

type StatusFields struct {
	HasStagedChanges        bool
	HasUnstagedChanges      bool
	Tracked                 bool
	Deleted                 bool
	Added                   bool
	HasMergeConflicts       bool
	HasInlineMergeConflicts bool
	ShortStatus             string
}

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

func (r *SubmoduleConfig) FullName() string

func (*SubmoduleConfig) FullPath

func (r *SubmoduleConfig) FullPath() string

func (*SubmoduleConfig) GitDirPath

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 (t *Tag) Description() string

func (*Tag) FullRefName

func (t *Tag) FullRefName() string

func (*Tag) ID

func (t *Tag) ID() string

func (*Tag) ParentRefName

func (t *Tag) ParentRefName() string

func (*Tag) RefName

func (t *Tag) RefName() string

func (*Tag) URN

func (t *Tag) URN() string

type Worktree

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

func (*Worktree) Description

func (w *Worktree) Description() string

func (*Worktree) ID

func (w *Worktree) ID() string

func (*Worktree) RefName

func (w *Worktree) RefName() string

Jump to

Keyboard shortcuts

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