summaryrefslogtreecommitdiffstats
path: root/pkg/gui/staging_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-11-05 18:44:46 +1100
committerJesse Duffield <jessedduffield@gmail.com>2019-11-05 19:22:01 +1100
commit72fe77097406bf4299fe74720e459cc229dd2391 (patch)
treeafc218582ed65c9815bb9ffbcad6d833bd5fca65 /pkg/gui/staging_panel.go
parentdb8c398fa33c6240bb4deca08aa6b5553497ef64 (diff)
better interface for ApplyPatch function
Diffstat (limited to 'pkg/gui/staging_panel.go')
-rw-r--r--pkg/gui/staging_panel.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/gui/staging_panel.go b/pkg/gui/staging_panel.go
index 55d38f282..35692757c 100644
--- a/pkg/gui/staging_panel.go
+++ b/pkg/gui/staging_panel.go
@@ -100,9 +100,13 @@ func (gui *Gui) applySelection(reverse bool) error {
// apply the patch then refresh this panel
// create a new temp file with the patch, then call git apply with that patch
- err = gui.GitCommand.ApplyPatch(patch, false, !reverse || state.SecondaryFocused, "")
+ applyFlags := []string{}
+ if !reverse || state.SecondaryFocused {
+ applyFlags = append(applyFlags, "cached")
+ }
+ err = gui.GitCommand.ApplyPatch(patch, applyFlags...)
if err != nil {
- return err
+ return gui.createErrorPanel(gui.g, err.Error())
}
if state.SelectMode == RANGE {