diff options
author | sudoburt <sudoburt@proton.me> | 2022-11-10 21:19:29 -0500 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-11-14 18:11:45 +1100 |
commit | 3e73dacce3365b540b278c3e1afb9bd8059d1ce7 (patch) | |
tree | d2706dc236491f7839ff5119e4eb60409e5bdbd8 /pkg/commands | |
parent | f67824b349fdbdcd1779e260f80bd26a446a4702 (diff) |
Merge loaders package into git_commands package
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git.go | 46 | ||||
-rw-r--r-- | pkg/commands/git_commands/branch_loader.go (renamed from pkg/commands/loaders/branches.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/branch_loader_test.go (renamed from pkg/commands/loaders/branches_test.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/commit_file_loader.go (renamed from pkg/commands/loaders/commit_files.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/commit_file_loader_test.go (renamed from pkg/commands/loaders/commit_files_test.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/commit_loader.go (renamed from pkg/commands/loaders/commits.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/commit_loader_test.go (renamed from pkg/commands/loaders/commits_test.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/deps_test.go | 5 | ||||
-rw-r--r-- | pkg/commands/git_commands/file_loader.go (renamed from pkg/commands/loaders/files.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/file_loader_test.go (renamed from pkg/commands/loaders/files_test.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/reflog_commit_loader.go (renamed from pkg/commands/loaders/reflog_commits.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/reflog_commit_loader_test.go (renamed from pkg/commands/loaders/reflog_commits_test.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/remote_loader.go (renamed from pkg/commands/loaders/remotes.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/stash.go | 7 | ||||
-rw-r--r-- | pkg/commands/git_commands/stash_loader.go (renamed from pkg/commands/loaders/stash.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/stash_loader_test.go (renamed from pkg/commands/loaders/stash_test.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/tag_loader.go (renamed from pkg/commands/loaders/tags.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/tag_loader_test.go (renamed from pkg/commands/loaders/tags_test.go) | 2 | ||||
-rw-r--r-- | pkg/commands/git_commands/working_tree.go | 7 |
19 files changed, 50 insertions, 45 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index a28e9afb6..2faa75c3d 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -11,7 +11,6 @@ import ( gogit "github.com/jesseduffield/go-git/v5" "github.com/jesseduffield/lazygit/pkg/commands/git_commands" "github.com/jesseduffield/lazygit/pkg/commands/git_config" - "github.com/jesseduffield/lazygit/pkg/commands/loaders" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/commands/patch" "github.com/jesseduffield/lazygit/pkg/common" @@ -42,14 +41,14 @@ type GitCommand struct { } type Loaders struct { - Branches *loaders.BranchLoader - CommitFiles *loaders.CommitFileLoader - Commits *loaders.CommitLoader - Files *loaders.FileLoader - ReflogCommits *loaders.ReflogCommitLoader - Remotes *loaders.RemoteLoader - Stash *loaders.StashLoader - Tags *loaders.TagLoader + BranchLoader *git_commands.BranchLoader + CommitFileLoader *git_commands.CommitFileLoader + CommitLoader *git_commands.CommitLoader + FileLoader *git_commands.FileLoader + ReflogCommitLoader *git_commands.ReflogCommitLoader + RemoteLoader *git_commands.RemoteLoader + StashLoader *git_commands.StashLoader + TagLoader *git_commands.TagLoader } func NewGitCommand( @@ -98,10 +97,11 @@ func NewGitCommandAux( // on the one struct. // common ones are: cmn, osCommand, dotGitDir, configCommands configCommands := git_commands.NewConfigCommands(cmn, gitConfig, repo) - gitCommon := git_commands.NewGitCommon(cmn, cmd, osCommand, dotGitDir, repo, configCommands, syncMutex) + fileLoader := git_commands.NewFileLoader(cmn, cmd, configCommands) + + gitCommon := git_commands.NewGitCommon(cmn, cmd, osCommand, dotGitDir, repo, configCommands, syncMutex) statusCommands := git_commands.NewStatusCommands(gitCommon) - fileLoader := loaders.NewFileLoader(cmn, cmd, configCommands) flowCommands := git_commands.NewFlowCommands(gitCommon) remoteCommands := git_commands.NewRemoteCommands(gitCommon) branchCommands := git_commands.NewBranchCommands(gitCommon) @@ -119,6 +119,14 @@ func NewGitCommandAux( patchCommands := git_commands.NewPatchCommands(gitCommon, rebaseCommands, commitCommands, statusCommands, stashCommands, patchManager) bisectCommands := git_commands.NewBisectCommands(gitCommon) + branchLoader := git_commands.NewBranchLoader(cmn, branchCommands.GetRawBranches, branchCommands.CurrentBranchName, configCommands) + commitFileLoader := git_commands.NewCommitFileLoader(cmn, cmd) + commitLoader := git_commands.NewCommitLoader(cmn, cmd, dotGitDir, branchCommands.CurrentBranchName, statusCommands.RebaseMode) + reflogCommitLoader := git_commands.NewReflogCommitLoader(cmn, cmd) + remoteLoader := git_commands.NewRemoteLoader(cmn, cmd, repo.Remotes) + stashLoader := git_commands.NewStashLoader(cmn, cmd) + tagLoader := git_commands.NewTagLoader(cmn, cmd) + return &GitCommand{ Branch: branchCommands, Commit: commitCommands, @@ -137,14 +145,14 @@ func NewGitCommandAux( Bisect: bisectCommands, WorkingTree: workingTreeCommands, Loaders: Loaders{ - Branches: loaders.NewBranchLoader(cmn, branchCommands.GetRawBranches, branchCommands.CurrentBranchName, configCommands), - CommitFiles: loaders.NewCommitFileLoader(cmn, cmd), - Commits: loaders.NewCommitLoader(cmn, cmd, dotGitDir, branchCommands.CurrentBranchName, statusCommands.RebaseMode), - Files: fileLoader, - ReflogCommits: loaders.NewReflogCommitLoader(cmn, cmd), - Remotes: loaders.NewRemoteLoader(cmn, cmd, repo.Remotes), - Stash: loaders.NewStashLoader(cmn, cmd), - Tags: loaders.NewTagLoader(cmn, cmd), + BranchLoader: branchLoader, + CommitFileLoader: commitFileLoader, + CommitLoader: commitLoader, + FileLoader: fileLoader, + ReflogCommitLoader: reflogCommitLoader, + RemoteLoader: remoteLoader, + StashLoader: stashLoader, + TagLoader: tagLoader, }, } } diff --git a/pkg/commands/loaders/branches.go b/pkg/commands/git_commands/branch_loader.go index 5a4502085..08811374d 100644 --- a/pkg/commands/loaders/branches.go +++ b/pkg/commands/git_commands/branch_loader.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "regexp" diff --git a/pkg/commands/loaders/branches_test.go b/pkg/commands/git_commands/branch_loader_test.go index 70f02dcf7..c147c1484 100644 --- a/pkg/commands/loaders/branches_test.go +++ b/pkg/commands/git_commands/branch_loader_test.go @@ -1,4 +1,4 @@ -package loaders +package git_commands // "*|feat/detect-purge|origin/feat/detect-purge|[ahead 1]" import ( diff --git a/pkg/commands/loaders/commit_files.go b/pkg/commands/git_commands/commit_file_loader.go index d68571edb..0b606ae86 100644 --- a/pkg/commands/loaders/commit_files.go +++ b/pkg/commands/git_commands/commit_file_loader.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "fmt" diff --git a/pkg/commands/loaders/commit_files_test.go b/pkg/commands/git_commands/commit_file_loader_test.go index a07390052..8928f5204 100644 --- a/pkg/commands/loaders/commit_files_test.go +++ b/pkg/commands/git_commands/commit_file_loader_test.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "testing" diff --git a/pkg/commands/loaders/commits.go b/pkg/commands/git_commands/commit_loader.go index 5f33408cd..21395fad4 100644 --- a/pkg/commands/loaders/commits.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "bytes" diff --git a/pkg/commands/loaders/commits_test.go b/pkg/commands/git_commands/commit_loader_test.go index a2a68fccc..7d45101ff 100644 --- a/pkg/commands/loaders/commits_test.go +++ b/pkg/commands/git_commands/commit_loader_test.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "path/filepath" diff --git a/pkg/commands/git_commands/deps_test.go b/pkg/commands/git_commands/deps_test.go index 535ba2712..df2c96253 100644 --- a/pkg/commands/git_commands/deps_test.go +++ b/pkg/commands/git_commands/deps_test.go @@ -6,7 +6,6 @@ import ( "github.com/go-errors/errors" gogit "github.com/jesseduffield/go-git/v5" "github.com/jesseduffield/lazygit/pkg/commands/git_config" - "github.com/jesseduffield/lazygit/pkg/commands/loaders" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/common" "github.com/jesseduffield/lazygit/pkg/config" @@ -89,8 +88,8 @@ func buildRepo() *gogit.Repository { return repo } -func buildFileLoader(gitCommon *GitCommon) *loaders.FileLoader { - return loaders.NewFileLoader(gitCommon.Common, gitCommon.cmd, gitCommon.config) +func buildFileLoader(gitCommon *GitCommon) *FileLoader { + return NewFileLoader(gitCommon.Common, gitCommon.cmd, gitCommon.config) } func buildSubmoduleCommands(deps commonDeps) *SubmoduleCommands { diff --git a/pkg/commands/loaders/files.go b/pkg/commands/git_commands/file_loader.go index 6d14bb590..9f33b811a 100644 --- a/pkg/commands/loaders/files.go +++ b/pkg/commands/git_commands/file_loader.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "fmt" diff --git a/pkg/commands/loaders/files_test.go b/pkg/commands/git_commands/file_loader_test.go index b860a1470..fac93eb52 100644 --- a/pkg/commands/loaders/files_test.go +++ b/pkg/commands/git_commands/file_loader_test.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "testing" diff --git a/pkg/commands/loaders/reflog_commits.go b/pkg/commands/git_commands/reflog_commit_loader.go index fe4e5e956..e2d3a7dad 100644 --- a/pkg/commands/loaders/reflog_commits.go +++ b/pkg/commands/git_commands/reflog_commit_loader.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "fmt" diff --git a/pkg/commands/loaders/reflog_commits_test.go b/pkg/commands/git_commands/reflog_commit_loader_test.go index 8a82d27ac..7170196e9 100644 --- a/pkg/commands/loaders/reflog_commits_test.go +++ b/pkg/commands/git_commands/reflog_commit_loader_test.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "errors" diff --git a/pkg/commands/loaders/remotes.go b/pkg/commands/git_commands/remote_loader.go index 1323560f5..71dc41b80 100644 --- a/pkg/commands/loaders/remotes.go +++ b/pkg/commands/git_commands/remote_loader.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "fmt" diff --git a/pkg/commands/git_commands/stash.go b/pkg/commands/git_commands/stash.go index 9c7321b50..eddf676ff 100644 --- a/pkg/commands/git_commands/stash.go +++ b/pkg/commands/git_commands/stash.go @@ -4,19 +4,18 @@ import ( "fmt" "strings" - "github.com/jesseduffield/lazygit/pkg/commands/loaders" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" ) type StashCommands struct { *GitCommon - fileLoader *loaders.FileLoader + fileLoader *FileLoader workingTree *WorkingTreeCommands } func NewStashCommands( gitCommon *GitCommon, - fileLoader *loaders.FileLoader, + fileLoader *FileLoader, workingTree *WorkingTreeCommands, ) *StashCommands { return &StashCommands{ @@ -111,7 +110,7 @@ func (self *StashCommands) SaveStagedChanges(message string) error { // meaning it's deleted in your working tree but added in your index. Given that it's // now safely stashed, we need to remove it. files := self.fileLoader. - GetStatusFiles(loaders.GetStatusFileOptions{}) + GetStatusFiles(GetStatusFileOptions{}) for _, file := range files { if file.ShortStatus == "AD" { diff --git a/pkg/commands/loaders/stash.go b/pkg/commands/git_commands/stash_loader.go index 4c9d16a23..0dea81c2c 100644 --- a/pkg/commands/loaders/stash.go +++ b/pkg/commands/git_commands/stash_loader.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "regexp" diff --git a/pkg/commands/loaders/stash_test.go b/pkg/commands/git_commands/stash_loader_test.go index 707be090e..2e2180fba 100644 --- a/pkg/commands/loaders/stash_test.go +++ b/pkg/commands/git_commands/stash_loader_test.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "testing" diff --git a/pkg/commands/loaders/tags.go b/pkg/commands/git_commands/tag_loader.go index 8e5063c34..738283405 100644 --- a/pkg/commands/loaders/tags.go +++ b/pkg/commands/git_commands/tag_loader.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "github.com/jesseduffield/generics/slices" diff --git a/pkg/commands/loaders/tags_test.go b/pkg/commands/git_commands/tag_loader_test.go index 5394fa3a8..f8696cafa 100644 --- a/pkg/commands/loaders/tags_test.go +++ b/pkg/commands/git_commands/tag_loader_test.go @@ -1,4 +1,4 @@ -package loaders +package git_commands import ( "testing" diff --git a/pkg/commands/git_commands/working_tree.go b/pkg/commands/git_commands/working_tree.go index 9c02d4300..7e08c348b 100644 --- a/pkg/commands/git_commands/working_tree.go +++ b/pkg/commands/git_commands/working_tree.go @@ -9,7 +9,6 @@ import ( "github.com/go-errors/errors" "github.com/jesseduffield/generics/slices" - "github.com/jesseduffield/lazygit/pkg/commands/loaders" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/utils" @@ -18,13 +17,13 @@ import ( type WorkingTreeCommands struct { *GitCommon submodule *SubmoduleCommands - fileLoader *loaders.FileLoader + fileLoader *FileLoader } func NewWorkingTreeCommands( gitCommon *GitCommon, submodule *SubmoduleCommands, - fileLoader *loaders.FileLoader, + fileLoader *FileLoader, ) *WorkingTreeCommands { return &WorkingTreeCommands{ GitCommon: gitCommon, @@ -90,7 +89,7 @@ func (self *WorkingTreeCommands) BeforeAndAfterFileForRename(file *models.File) // all files, passing the --no-renames flag and then recursively call the function // again for the before file and after file. - filesWithoutRenames := self.fileLoader.GetStatusFiles(loaders.GetStatusFileOptions{NoRenames: true}) + filesWithoutRenames := self.fileLoader.GetStatusFiles(GetStatusFileOptions{NoRenames: true}) var beforeFile *models.File var afterFile *models.File |