diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-15 11:18:40 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-15 11:41:37 +1000 |
commit | 826d1660c97b7c5c55420ffed21eaa5f16118118 (patch) | |
tree | 8f2f65a3d2617aa242034273c4a41b6ec5aea659 /pkg/commands/git.go | |
parent | 291a8e4de0f5d5557cf6fbd7b5b6b9d42bcaa16e (diff) |
move patch stuff into its own package
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r-- | pkg/commands/git.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index f4fde0e89..a98ad42d1 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -16,6 +16,7 @@ import ( "github.com/go-errors/errors" gogit "github.com/go-git/go-git/v5" + "github.com/jesseduffield/lazygit/pkg/commands/patch" "github.com/jesseduffield/lazygit/pkg/config" "github.com/jesseduffield/lazygit/pkg/i18n" "github.com/jesseduffield/lazygit/pkg/utils" @@ -84,7 +85,7 @@ type GitCommand struct { removeFile func(string) error DotGitDir string onSuccessfulContinue func() error - PatchManager *PatchManager + PatchManager *patch.PatchManager // Push to current determines whether the user has configured to push to the remote branch of the same name as the current or not PushToCurrent bool @@ -143,7 +144,7 @@ func NewGitCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Localizer, PushToCurrent: pushToCurrent, } - gitCommand.PatchManager = NewPatchManager(log, gitCommand.ApplyPatch) + gitCommand.PatchManager = patch.NewPatchManager(log, gitCommand.ApplyPatch) return gitCommand, nil } @@ -1038,7 +1039,7 @@ func (c *GitCommand) CherryPickCommits(commits []*Commit) error { } // GetCommitFiles get the specified commit files -func (c *GitCommand) GetCommitFiles(commitSha string, patchManager *PatchManager) ([]*CommitFile, error) { +func (c *GitCommand) GetCommitFiles(commitSha string, patchManager *patch.PatchManager) ([]*CommitFile, error) { files, err := c.OSCommand.RunCommandWithOutput("git diff-tree --no-commit-id --name-only -r --no-renames %s", commitSha) if err != nil { return nil, err @@ -1047,7 +1048,7 @@ func (c *GitCommand) GetCommitFiles(commitSha string, patchManager *PatchManager commitFiles := make([]*CommitFile, 0) for _, file := range strings.Split(strings.TrimRight(files, "\n"), "\n") { - status := UNSELECTED + status := patch.UNSELECTED if patchManager != nil && patchManager.CommitSha == commitSha { status = patchManager.GetFileStatus(file) } |