File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,16 @@ func (self *CherryPickHelper) Paste() error {
78
78
}),
79
79
HandleConfirm : func () error {
80
80
return self .c .WithWaitingStatus (self .c .Tr .CherryPickingStatus , func (gocui.Task ) error {
81
+ mustStash := IsWorkingTreeDirty (self .c .Model ().Files )
82
+
81
83
self .c .LogAction (self .c .Tr .Actions .CherryPick )
84
+
85
+ if mustStash {
86
+ if err := self .c .Git ().Stash .Push (self .c .Tr .AutoStashForCherryPicking ); err != nil {
87
+ return err
88
+ }
89
+ }
90
+
82
91
result := self .c .Git ().Rebase .CherryPickCommits (self .getData ().CherryPickedCommits )
83
92
err := self .rebaseHelper .CheckMergeOrRebase (result )
84
93
if err != nil {
@@ -96,7 +105,17 @@ func (self *CherryPickHelper) Paste() error {
96
105
if ! isInCherryPick {
97
106
self .getData ().DidPaste = true
98
107
self .rerender ()
108
+
109
+ if mustStash {
110
+ if err := self .c .Git ().Stash .Pop (0 ); err != nil {
111
+ return err
112
+ }
113
+ self .c .Refresh (types.RefreshOptions {
114
+ Scope : []types.RefreshableView {types .STASH , types .FILES },
115
+ })
116
+ }
99
117
}
118
+
100
119
return nil
101
120
})
102
121
},
Original file line number Diff line number Diff line change @@ -451,6 +451,7 @@ type TranslationSet struct {
451
451
AutoStashForCheckout string
452
452
AutoStashForNewBranch string
453
453
AutoStashForMovingPatchToIndex string
454
+ AutoStashForCherryPicking string
454
455
Discard string
455
456
DiscardChangesTitle string
456
457
DiscardFileChangesTooltip string
@@ -1547,6 +1548,7 @@ func EnglishTranslationSet() *TranslationSet {
1547
1548
AutoStashForCheckout : "Auto-stashing changes for checking out %s" ,
1548
1549
AutoStashForNewBranch : "Auto-stashing changes for creating new branch %s" ,
1549
1550
AutoStashForMovingPatchToIndex : "Auto-stashing changes for moving custom patch to index from %s" ,
1551
+ AutoStashForCherryPicking : "Auto-stashing changes for cherry-picking commits" ,
1550
1552
Discard : "Discard" ,
1551
1553
DiscardFileChangesTooltip : "View options for discarding changes to the selected file." ,
1552
1554
DiscardChangesTitle : "Discard changes" ,
You can’t perform that action at this time.
0 commit comments