diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-09-29 18:48:38 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-09-29 20:48:49 +1000 |
commit | f9643448a4ba186fb56d408a5ee8a21193986cd6 (patch) | |
tree | a15d3291ebc269536c3abbbf88542a25689a971c /pkg/commands | |
parent | 91f0b0e28fb93bf715a4fda67fcbb400ffbc680b (diff) |
move commit files
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/commit_file.go | 21 | ||||
-rw-r--r-- | pkg/commands/git.go | 8 |
2 files changed, 4 insertions, 25 deletions
diff --git a/pkg/commands/commit_file.go b/pkg/commands/commit_file.go deleted file mode 100644 index c2131ace1..000000000 --- a/pkg/commands/commit_file.go +++ /dev/null @@ -1,21 +0,0 @@ -package commands - -// CommitFile : A git commit file -type CommitFile struct { - // Parent is the identifier of the parent object e.g. a commit SHA if this commit file is for a commit, or a stash entry ref like 'stash@{1}' - Parent string - Name string - - // PatchStatus tells us whether the file has been wholly or partially added to a patch. We might want to pull this logic up into the gui package and make it a map like we do with cherry picked commits - PatchStatus int // one of 'WHOLE' 'PART' 'NONE' - - ChangeStatus string // e.g. 'A' for added or 'M' for modified. This is based on the result from git diff --name-status -} - -func (f *CommitFile) ID() string { - return f.Name -} - -func (f *CommitFile) Description() string { - return f.Name -} diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 2d75330e6..5c3e423db 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -1120,7 +1120,7 @@ func (c *GitCommand) CherryPickCommits(commits []*models.Commit) error { } // GetFilesInDiff get the specified commit files -func (c *GitCommand) GetFilesInDiff(from string, to string, reverse bool, patchManager *patch.PatchManager) ([]*CommitFile, error) { +func (c *GitCommand) GetFilesInDiff(from string, to string, reverse bool, patchManager *patch.PatchManager) ([]*models.CommitFile, error) { reverseFlag := "" if reverse { reverseFlag = " -R " @@ -1135,8 +1135,8 @@ func (c *GitCommand) GetFilesInDiff(from string, to string, reverse bool, patchM } // filenames string is something like "file1\nfile2\nfile3" -func (c *GitCommand) GetCommitFilesFromFilenames(filenames string, parent string, patchManager *patch.PatchManager) []*CommitFile { - commitFiles := make([]*CommitFile, 0) +func (c *GitCommand) GetCommitFilesFromFilenames(filenames string, parent string, patchManager *patch.PatchManager) []*models.CommitFile { + commitFiles := make([]*models.CommitFile, 0) for _, line := range strings.Split(strings.TrimRight(filenames, "\n"), "\n") { // typical result looks like 'A my_file' meaning my_file was added @@ -1150,7 +1150,7 @@ func (c *GitCommand) GetCommitFilesFromFilenames(filenames string, parent string status = patchManager.GetFileStatus(name) } - commitFiles = append(commitFiles, &CommitFile{ + commitFiles = append(commitFiles, &models.CommitFile{ Parent: parent, Name: name, ChangeStatus: changeStatus, |