Documentation ¶
Index ¶
- 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(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() map[string]bool
- 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) PrepareCommitAmendSubProcess() *exec.Cmd
- 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) 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)
- 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) Unquote(message string) string
- type Platform
- type StashEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branch ¶
Branch : A git branch duplicating this for now
func (*Branch) GetDisplayStrings ¶ added in v0.3.0
GetDisplayStrings 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 file from git status duplicating this for now
func (*File) GetDisplayStrings ¶ added in v0.3.0
GetDisplayStrings returns the display string of a file
type GitCommand ¶
type GitCommand struct { Log *logrus.Entry OSCommand *OSCommand Worktree *gogit.Worktree Repo *gogit.Repository Tr *i18n.Localizer // contains filtered or unexported fields }
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 obtains the content 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) Commit ¶
func (c *GitCommand) Commit(message string) (*exec.Cmd, error)
Commit commits to git
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() map[string]bool
GetCommitsToPush Returns the sha's of the commits that have not yet been pushed to the remote branch of the current branch, a map is returned to ease look up
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) PrepareCommitAmendSubProcess ¶ added in v0.2.2
func (c *GitCommand) PrepareCommitAmendSubProcess() *exec.Cmd
PrepareCommitAmendSubProcess prepares a subprocess for `git commit --amend --allow-empty`
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 pushes 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
type OSCommand ¶
type OSCommand struct { Log *logrus.Entry Platform *Platform Config config.AppConfigurer // contains filtered or unexported fields }
OSCommand holds all the os commands
func NewOSCommand ¶
func NewOSCommand(log *logrus.Entry, config config.AppConfigurer) *OSCommand
NewOSCommand os command runner
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
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform stores the os state
type StashEntry ¶
StashEntry : A git stash entry
func (*StashEntry) GetDisplayStrings ¶ added in v0.3.0
func (s *StashEntry) GetDisplayStrings() []string
GetDisplayStrings returns the dispaly string of branch