Documentation ¶
Index ¶
- func Map(vs []string, f func(string) string) []string
- type Branch
- type Commit
- type Conflict
- type File
- type GitCommand
- func (c *GitCommand) AbortMerge() error
- func (c *GitCommand) AddPatch(filename string) *exec.Cmd
- func (c *GitCommand) CatFile(fileName string) (string, error)
- func (c *GitCommand) Checkout(branch string, force bool) error
- func (c *GitCommand) Commit(g *gocui.Gui, message string) (*exec.Cmd, error)
- func (c *GitCommand) DeleteBranch(branch string, force bool) error
- func (c *GitCommand) Diff(file File) string
- func (c *GitCommand) Fetch() error
- func (c *GitCommand) GetBranchGraph(branchName string) (string, error)
- func (c *GitCommand) GetBranchName() (string, error)
- func (c *GitCommand) GetCommits() []Commit
- func (c *GitCommand) GetCommitsToPush() []string
- func (c *GitCommand) GetLog() string
- func (c *GitCommand) GetStashEntries() []StashEntry
- func (c *GitCommand) GetStashEntryDiff(index int) (string, error)
- func (c *GitCommand) GetStatusFiles() []File
- func (c *GitCommand) GitStatus() (string, error)
- func (c *GitCommand) Ignore(filename string) error
- func (c *GitCommand) IsInMergeState() (bool, error)
- func (c *GitCommand) ListStash() (string, error)
- func (c *GitCommand) Merge(branchName string) error
- func (c *GitCommand) MergeStatusFiles(oldFiles, newFiles []File) []File
- func (c *GitCommand) NewBranch(name string) error
- func (c *GitCommand) PrepareCommitSubProcess() *exec.Cmd
- func (c *GitCommand) Pull() error
- func (c *GitCommand) Push(branchName string, force bool) error
- func (c *GitCommand) RemoveFile(file File) error
- func (c *GitCommand) RenameCommit(name string) error
- func (c *GitCommand) ResetHard() error
- func (c *GitCommand) ResetToCommit(sha string) error
- func (c *GitCommand) SetupGit()
- func (c *GitCommand) Show(sha string) string
- func (c *GitCommand) SquashFixupCommit(branchName string, shaValue string) error
- func (c *GitCommand) SquashPreviousTwoCommits(message string) error
- func (c *GitCommand) StageAll() error
- func (c *GitCommand) StageFile(fileName string) error
- func (c *GitCommand) StashDo(index int, method string) error
- func (c *GitCommand) StashSave(message string) error
- func (c *GitCommand) UnStageFile(fileName string, tracked bool) error
- func (c *GitCommand) UnstageAll() error
- func (c *GitCommand) UpstreamDifferenceCount() (string, string)
- func (c *GitCommand) UsingGpg() bool
- type OSCommand
- func (c *OSCommand) AppendLineToFile(filename, line string) error
- func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error)
- func (c *OSCommand) FileType(path string) string
- func (c *OSCommand) OpenFile(filename string) error
- func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) *exec.Cmd
- func (c *OSCommand) Quote(message string) string
- func (c *OSCommand) RunCommand(command string) error
- func (c *OSCommand) RunCommandWithOutput(command string) (string, error)
- func (c *OSCommand) RunDirectCommand(command string) (string, error)
- func (c *OSCommand) SublimeOpenFile(filename string) (*exec.Cmd, error)
- func (c *OSCommand) Unquote(message string) string
- func (c *OSCommand) VsCodeOpenFile(filename string) (*exec.Cmd, error)
- type Platform
- type StashEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Branch ¶
Branch : A git branch duplicating this for now
func (*Branch) GetDisplayString ¶
GetDisplayString returns the dispaly string of branch
type Conflict ¶
Conflict : A git conflict with a start middle and end corresponding to line numbers in the file where the conflict bars appear
type File ¶
type File struct { Name string HasStagedChanges bool HasUnstagedChanges bool Tracked bool Deleted bool HasMergeConflicts bool DisplayString string Type string // one of 'file', 'directory', and 'other' }
File : A staged/unstaged file
type GitCommand ¶
type GitCommand struct { Log *logrus.Entry OSCommand *OSCommand Worktree *gogit.Worktree Repo *gogit.Repository Tr *i18n.Localizer }
GitCommand is our main git interface
func NewGitCommand ¶
func NewGitCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Localizer) (*GitCommand, error)
NewGitCommand it runs git commands
func (*GitCommand) AddPatch ¶
func (c *GitCommand) AddPatch(filename string) *exec.Cmd
AddPatch prepares a subprocess for adding a patch by patch this will eventually be swapped out for a better solution inside the Gui
func (*GitCommand) CatFile ¶
func (c *GitCommand) CatFile(fileName string) (string, error)
CatFile obtain the contents of a file
func (*GitCommand) Checkout ¶
func (c *GitCommand) Checkout(branch string, force bool) error
Checkout checks out a branch, with --force if you set the force arg to true
func (*GitCommand) DeleteBranch ¶
func (c *GitCommand) DeleteBranch(branch string, force bool) error
DeleteBranch delete branch
func (*GitCommand) Diff ¶
func (c *GitCommand) Diff(file File) string
Diff returns the diff of a file
func (*GitCommand) GetBranchGraph ¶
func (c *GitCommand) GetBranchGraph(branchName string) (string, error)
GetBranchGraph gets the color-formatted graph of the log for the given branch Currently it limits the result to 100 commits, but when we get async stuff working we can do lazy loading
func (*GitCommand) GetBranchName ¶
func (c *GitCommand) GetBranchName() (string, error)
GetBranchName branch name
func (*GitCommand) GetCommits ¶
func (c *GitCommand) GetCommits() []Commit
GetCommits obtains the commits of the current branch
func (*GitCommand) GetCommitsToPush ¶
func (c *GitCommand) GetCommitsToPush() []string
GetCommitsToPush Returns the sha's of the commits that have not yet been pushed to the remote branch of the current branch
func (*GitCommand) GetLog ¶
func (c *GitCommand) GetLog() string
GetLog gets the git log (currently limited to 30 commits for performance until we work out lazy loading
func (*GitCommand) GetStashEntries ¶
func (c *GitCommand) GetStashEntries() []StashEntry
GetStashEntries stash entryies
func (*GitCommand) GetStashEntryDiff ¶
func (c *GitCommand) GetStashEntryDiff(index int) (string, error)
GetStashEntryDiff stash diff
func (*GitCommand) GetStatusFiles ¶
func (c *GitCommand) GetStatusFiles() []File
GetStatusFiles git status files
func (*GitCommand) GitStatus ¶
func (c *GitCommand) GitStatus() (string, error)
GitStatus returns the plaintext short status of the repo
func (*GitCommand) Ignore ¶
func (c *GitCommand) Ignore(filename string) error
Ignore adds a file to the gitignore for the repo
func (*GitCommand) IsInMergeState ¶
func (c *GitCommand) IsInMergeState() (bool, error)
IsInMergeState states whether we are still mid-merge
func (*GitCommand) ListStash ¶
func (c *GitCommand) ListStash() (string, error)
ListStash list stash
func (*GitCommand) MergeStatusFiles ¶
func (c *GitCommand) MergeStatusFiles(oldFiles, newFiles []File) []File
MergeStatusFiles merge status files
func (*GitCommand) NewBranch ¶
func (c *GitCommand) NewBranch(name string) error
NewBranch create new branch
func (*GitCommand) PrepareCommitSubProcess ¶
func (c *GitCommand) PrepareCommitSubProcess() *exec.Cmd
PrepareCommitSubProcess prepares a subprocess for `git commit`
func (*GitCommand) Push ¶
func (c *GitCommand) Push(branchName string, force bool) error
Push push to a branch
func (*GitCommand) RemoveFile ¶
func (c *GitCommand) RemoveFile(file File) error
RemoveFile directly
func (*GitCommand) RenameCommit ¶
func (c *GitCommand) RenameCommit(name string) error
RenameCommit renames the topmost commit with the given name
func (*GitCommand) ResetHard ¶
func (c *GitCommand) ResetHard() error
ResetHard does the equivalent of `git reset --hard HEAD`
func (*GitCommand) ResetToCommit ¶
func (c *GitCommand) ResetToCommit(sha string) error
ResetToCommit reset to commit
func (*GitCommand) Show ¶
func (c *GitCommand) Show(sha string) string
Show shows the diff of a commit
func (*GitCommand) SquashFixupCommit ¶
func (c *GitCommand) SquashFixupCommit(branchName string, shaValue string) error
SquashFixupCommit squashes a 'FIXUP' commit into the commit beneath it, retaining the commit message of the lower commit
func (*GitCommand) SquashPreviousTwoCommits ¶
func (c *GitCommand) SquashPreviousTwoCommits(message string) error
SquashPreviousTwoCommits squashes a commit down to the one below it retaining the message of the higher commit
func (*GitCommand) StageAll ¶ added in v0.2.0
func (c *GitCommand) StageAll() error
StageAll stages all files
func (*GitCommand) StageFile ¶
func (c *GitCommand) StageFile(fileName string) error
StageFile stages a file
func (*GitCommand) StashDo ¶
func (c *GitCommand) StashDo(index int, method string) error
StashDo modify stash
func (*GitCommand) StashSave ¶
func (c *GitCommand) StashSave(message string) error
StashSave save stash TODO: before calling this, check if there is anything to save
func (*GitCommand) UnStageFile ¶
func (c *GitCommand) UnStageFile(fileName string, tracked bool) error
UnStageFile unstages a file
func (*GitCommand) UnstageAll ¶ added in v0.2.0
func (c *GitCommand) UnstageAll() error
UnstageAll stages all files
func (*GitCommand) UpstreamDifferenceCount ¶
func (c *GitCommand) UpstreamDifferenceCount() (string, string)
UpstreamDifferenceCount checks how many pushables/pullables there are for the current branch
func (*GitCommand) UsingGpg ¶
func (c *GitCommand) UsingGpg() bool
UsingGpg tells us whether the user has gpg enabled so that we can know whether we need to run a subprocess to allow them to enter their password
type OSCommand ¶
type OSCommand struct { Log *logrus.Entry Platform *Platform // contains filtered or unexported fields }
OSCommand holds all the os commands
func (*OSCommand) AppendLineToFile ¶ added in v0.1.73
AppendLineToFile adds a new line in file
func (*OSCommand) EditFile ¶
EditFile opens a file in a subprocess using whatever editor is available, falling back to core.editor, VISUAL, EDITOR, then vi
func (*OSCommand) FileType ¶ added in v0.2.0
FileType tells us if the file is a file, directory or other
func (*OSCommand) PrepareSubProcess ¶
PrepareSubProcess iniPrepareSubProcessrocess then tells the Gui to switch to it
func (*OSCommand) RunCommand ¶
RunCommand runs a command and just returns the error
func (*OSCommand) RunCommandWithOutput ¶
RunCommandWithOutput wrapper around commands returning their output and error
func (*OSCommand) RunDirectCommand ¶
RunDirectCommand wrapper around direct commands
func (*OSCommand) SublimeOpenFile ¶
SublimeOpenFile opens the filein sublime may be deprecated in the future
func (*OSCommand) Unquote ¶ added in v0.1.71
Unquote removes wrapping quotations marks if they are present this is needed for removing quotes from staged filenames with spaces
func (*OSCommand) VsCodeOpenFile ¶
VsCodeOpenFile opens the file in code, with the -r flag to open in the current window each of these open files needs to have the same function signature because they're being passed as arguments into another function, but only editFile actually returns a *exec.Cmd
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform stores the os state
type StashEntry ¶
StashEntry : A git stash entry