From 72fe77097406bf4299fe74720e459cc229dd2391 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 5 Nov 2019 18:44:46 +1100 Subject: better interface for ApplyPatch function --- pkg/gui/staging_panel.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pkg/gui/staging_panel.go') 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 { -- cgit v1.2.3