@@ -88,29 +88,31 @@ func (self *UndoController) reflogUndo() error {
8888 }
8989
9090 switch action .kind {
91- case COMMIT :
92- self .c .Confirm (types.ConfirmOpts {
93- Title : self .c .Tr .Actions .Undo ,
94- Prompt : fmt .Sprintf (self .c .Tr .SoftResetAutostashPrompt , action .from ),
95- HandleConfirm : func () error {
96- self .c .LogAction (self .c .Tr .Actions .Undo )
97- return self .resetWithAutoStash (action .from , resetOptions {
98- Mode : "soft" ,
99- EnvVars : undoEnvVars ,
100- WaitingStatus : undoingStatus ,
101- })
102- },
103- })
104- return true , nil
91+ case COMMIT , REBASE :
92+ var resetMode string
93+ switch action .kind {
94+ case COMMIT :
95+ resetMode = "soft"
96+ case REBASE :
97+ resetMode = "hard"
98+ }
99+
100+ var resetPrompt string
101+ switch resetMode {
102+ case "hard" :
103+ resetPrompt = self .c .Tr .HardResetAutostashPrompt
104+ case "soft" :
105+ resetPrompt = self .c .Tr .SoftResetAutostashPrompt
106+ }
105107
106- case REBASE :
108+ // 3. Use those in the confirm step
107109 self .c .Confirm (types.ConfirmOpts {
108110 Title : self .c .Tr .Actions .Undo ,
109- Prompt : fmt .Sprintf (self . c . Tr . HardResetAutostashPrompt , action .from ),
111+ Prompt : fmt .Sprintf (resetPrompt , action .from ),
110112 HandleConfirm : func () error {
111113 self .c .LogAction (self .c .Tr .Actions .Undo )
112114 return self .resetWithAutoStash (action .from , resetOptions {
113- Mode : "hard" ,
115+ Mode : resetMode ,
114116 EnvVars : undoEnvVars ,
115117 WaitingStatus : undoingStatus ,
116118 })
@@ -158,22 +160,7 @@ func (self *UndoController) reflogRedo() error {
158160 }
159161
160162 switch action .kind {
161- case COMMIT :
162- self .c .Confirm (types.ConfirmOpts {
163- Title : self .c .Tr .Actions .Redo ,
164- Prompt : fmt .Sprintf (self .c .Tr .SoftResetAutostashPrompt , action .to ),
165- HandleConfirm : func () error {
166- self .c .LogAction (self .c .Tr .Actions .Redo )
167- return self .resetWithAutoStash (action .to , resetOptions {
168- Mode : "soft" ,
169- EnvVars : redoEnvVars ,
170- WaitingStatus : redoingStatus ,
171- })
172- },
173- })
174- return true , nil
175-
176- case REBASE :
163+ case COMMIT , REBASE :
177164 self .c .Confirm (types.ConfirmOpts {
178165 Title : self .c .Tr .Actions .Redo ,
179166 Prompt : fmt .Sprintf (self .c .Tr .HardResetAutostashPrompt , action .to ),
0 commit comments