diff options
-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 | ||||
-rw-r--r-- | pkg/gui/commit_files_panel.go | 10 | ||||
-rw-r--r-- | pkg/gui/patch_building_panel.go | 2 |
5 files changed, 13 insertions, 13 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) }, }, diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go index cb41c4a25..327c4450c 100644 --- a/pkg/gui/commit_files_panel.go +++ b/pkg/gui/commit_files_panel.go @@ -27,7 +27,7 @@ func (gui *Gui) handleCommitFileSelect() error { } cmd := gui.OSCommand.ExecutableFromString( - gui.GitCommand.ShowCommitFileCmdStr(commitFile.Sha, commitFile.Name, false), + gui.GitCommand.ShowCommitFileCmdStr(commitFile.Parent, commitFile.Name, false), ) task := gui.createRunPtyTask(cmd) @@ -43,7 +43,7 @@ func (gui *Gui) handleCommitFileSelect() error { func (gui *Gui) handleCheckoutCommitFile(g *gocui.Gui, v *gocui.View) error { file := gui.State.CommitFiles[gui.State.Panels.CommitFiles.SelectedLineIdx] - if err := gui.GitCommand.CheckoutFile(file.Sha, file.Name); err != nil { + if err := gui.GitCommand.CheckoutFile(file.Parent, file.Name); err != nil { return gui.surfaceError(err) } @@ -133,7 +133,7 @@ func (gui *Gui) handleToggleFileForPatch(g *gocui.Gui, v *gocui.View) error { return gui.refreshCommitFilesView() } - if gui.GitCommand.PatchManager.CommitSelected() && gui.GitCommand.PatchManager.CommitSha != commitFile.Sha { + if gui.GitCommand.PatchManager.CommitSelected() && gui.GitCommand.PatchManager.CommitSha != commitFile.Parent { return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, @@ -152,7 +152,7 @@ func (gui *Gui) handleToggleFileForPatch(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) startPatchManager() error { diffMap := map[string]string{} for _, commitFile := range gui.State.CommitFiles { - commitText, err := gui.GitCommand.ShowCommitFile(commitFile.Sha, commitFile.Name, true) + commitText, err := gui.GitCommand.ShowCommitFile(commitFile.Parent, commitFile.Name, true) if err != nil { return err } @@ -196,7 +196,7 @@ func (gui *Gui) enterCommitFile(selectedLineIdx int) error { return gui.refreshPatchBuildingPanel(selectedLineIdx) } - if gui.GitCommand.PatchManager.CommitSelected() && gui.GitCommand.PatchManager.CommitSha != commitFile.Sha { + if gui.GitCommand.PatchManager.CommitSelected() && gui.GitCommand.PatchManager.CommitSha != commitFile.Parent { return gui.ask(askOpts{ returnToView: gui.getCommitFilesView(), returnFocusOnClose: false, diff --git a/pkg/gui/patch_building_panel.go b/pkg/gui/patch_building_panel.go index 0df46fe8f..76589505a 100644 --- a/pkg/gui/patch_building_panel.go +++ b/pkg/gui/patch_building_panel.go @@ -22,7 +22,7 @@ func (gui *Gui) refreshPatchBuildingPanel(selectedLineIdx int) error { return nil } - diff, err := gui.GitCommand.ShowCommitFile(commitFile.Sha, commitFile.Name, true) + diff, err := gui.GitCommand.ShowCommitFile(commitFile.Parent, commitFile.Name, true) if err != nil { return err } |