diff options
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/commit_file.go | 2 | ||||
-rw-r--r-- | pkg/commands/git.go | 8 | ||||
-rw-r--r-- | pkg/commands/git_test.go | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/pkg/commands/commit_file.go b/pkg/commands/commit_file.go index aa21d77ee..a2cf6eb20 100644 --- a/pkg/commands/commit_file.go +++ b/pkg/commands/commit_file.go @@ -2,7 +2,7 @@ package commands // CommitFile : A git commit file type CommitFile struct { - Sha string + Parent string Name string DisplayString string Status int // one of 'WHOLE' 'PART' 'NONE' diff --git a/pkg/commands/git.go b/pkg/commands/git.go index eac5c0a53..243457c4f 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -1046,13 +1046,13 @@ func (c *GitCommand) CherryPickCommits(commits []*Commit) error { } // GetFilesInRef get the specified commit files -func (c *GitCommand) GetFilesInRef(commitSha string, isStash bool, patchManager *patch.PatchManager) ([]*CommitFile, error) { +func (c *GitCommand) GetFilesInRef(parent string, isStash bool, patchManager *patch.PatchManager) ([]*CommitFile, error) { command := "git diff-tree" if isStash { command = "git stash show" } - files, err := c.OSCommand.RunCommandWithOutput("%s --no-commit-id --name-only -r --no-renames %s", command, commitSha) + files, err := c.OSCommand.RunCommandWithOutput("%s --no-commit-id --name-only -r --no-renames %s", command, parent) if err != nil { return nil, err } @@ -1061,12 +1061,12 @@ func (c *GitCommand) GetFilesInRef(commitSha string, isStash bool, patchManager for _, file := range strings.Split(strings.TrimRight(files, "\n"), "\n") { status := patch.UNSELECTED - if patchManager != nil && patchManager.CommitSha == commitSha { + if patchManager != nil && patchManager.CommitSha == parent { status = patchManager.GetFileStatus(file) } commitFiles = append(commitFiles, &CommitFile{ - Sha: commitSha, + Parent: parent, Name: file, DisplayString: file, Status: status, diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index fba4d0482..7a892eec8 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -1874,8 +1874,8 @@ func TestGitCommandGetFilesInRef(t *testing.T) { func(commitFiles []*CommitFile, err error) { assert.NoError(t, err) assert.Equal(t, []*CommitFile{ - {Sha: "123456", Name: "hello", DisplayString: "hello"}, - {Sha: "123456", Name: "world", DisplayString: "world"}, + {Parent: "123456", Name: "hello", DisplayString: "hello"}, + {Parent: "123456", Name: "world", DisplayString: "world"}, }, commitFiles) }, }, |