File tree Expand file tree Collapse file tree 6 files changed +29
-17
lines changed Expand file tree Collapse file tree 6 files changed +29
-17
lines changed Original file line number Diff line number Diff line change @@ -87,12 +87,23 @@ func (self *CherryPickHelper) Paste() error {
87
87
}
88
88
}
89
89
90
- result := self .c .Git ().Rebase .CherryPickCommits (self .getData ().CherryPickedCommits )
91
- err := self .rebaseHelper .CheckMergeOrRebase (result )
90
+ cherryPickedCommits := self .getData ().CherryPickedCommits
91
+ result := self .c .Git ().Rebase .CherryPickCommits (cherryPickedCommits )
92
+ err := self .rebaseHelper .CheckMergeOrRebaseWithRefreshOptions (result , types.RefreshOptions {Mode : types .SYNC })
92
93
if err != nil {
93
94
return result
94
95
}
95
96
97
+ // Move the selection down by the number of commits we just
98
+ // cherry-picked, to keep the same commit selected as before.
99
+ // Don't do this if a rebase todo is selected, because in this
100
+ // case we are in a rebase and the cherry-picked commits end up
101
+ // below the selection.
102
+ if commit := self .c .Contexts ().LocalCommits .GetSelected (); commit != nil && ! commit .IsTODO () {
103
+ self .c .Contexts ().LocalCommits .MoveSelection (len (cherryPickedCommits ))
104
+ self .c .Contexts ().LocalCommits .FocusLine ()
105
+ }
106
+
96
107
// If we're in the cherry-picking state at this point, it must
97
108
// be because there were conflicts. Don't clear the copied
98
109
// commits in this case, since we might want to abort and try
Original file line number Diff line number Diff line change @@ -73,9 +73,9 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
73
73
t .Views ().Information ().Content (DoesNotContain ("commits copied" ))
74
74
}).
75
75
Lines (
76
- Contains ("four" ). IsSelected () ,
76
+ Contains ("four" ),
77
77
Contains ("three" ),
78
- Contains ("two" ),
78
+ Contains ("two" ). IsSelected () ,
79
79
Contains ("one" ),
80
80
Contains ("base" ),
81
81
)
@@ -102,9 +102,9 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
102
102
t .Views ().Information ().Content (DoesNotContain ("commits copied" ))
103
103
}).
104
104
Lines (
105
- Contains ("four" ). IsSelected () ,
105
+ Contains ("four" ),
106
106
Contains ("three" ),
107
- Contains ("base" ),
107
+ Contains ("base" ). IsSelected () ,
108
108
)
109
109
},
110
110
})
Original file line number Diff line number Diff line change @@ -79,17 +79,17 @@ var CherryPickDuringRebase = NewIntegrationTest(NewIntegrationTestArgs{
79
79
Contains ("--- Pending rebase todos ---" ),
80
80
Contains ("pick CI two" ),
81
81
Contains ("--- Commits ---" ),
82
- Contains (" CI three" ). IsSelected () ,
83
- Contains (" CI one" ),
82
+ Contains (" CI three" ),
83
+ Contains (" CI one" ). IsSelected () ,
84
84
Contains (" CI base" ),
85
85
).
86
86
Tap (func () {
87
87
t .Common ().ContinueRebase ()
88
88
}).
89
89
Lines (
90
90
Contains ("CI two" ),
91
- Contains ("CI three" ). IsSelected () ,
92
- Contains ("CI one" ),
91
+ Contains ("CI three" ),
92
+ Contains ("CI one" ). IsSelected () ,
93
93
Contains ("CI base" ),
94
94
)
95
95
},
Original file line number Diff line number Diff line change @@ -63,9 +63,10 @@ var CherryPickMerge = NewIntegrationTest(NewIntegrationTestArgs{
63
63
t .Views ().Information ().Content (DoesNotContain ("commit copied" ))
64
64
}).
65
65
Lines (
66
- Contains ("Merge branch 'second-branch'" ).IsSelected (),
67
- Contains ("base" ),
68
- )
66
+ Contains ("Merge branch 'second-branch'" ),
67
+ Contains ("base" ).IsSelected (),
68
+ ).
69
+ SelectPreviousItem ()
69
70
70
71
t .Views ().Main ().ContainsLines (
71
72
Contains ("Merge branch 'second-branch'" ),
Original file line number Diff line number Diff line change @@ -70,9 +70,9 @@ var CherryPickRange = NewIntegrationTest(NewIntegrationTestArgs{
70
70
t .Views ().Information ().Content (DoesNotContain ("commits copied" ))
71
71
}).
72
72
Lines (
73
- Contains ("four" ). IsSelected () ,
73
+ Contains ("four" ),
74
74
Contains ("three" ),
75
- Contains ("two" ),
75
+ Contains ("two" ). IsSelected () ,
76
76
Contains ("one" ),
77
77
Contains ("base" ),
78
78
)
Original file line number Diff line number Diff line change @@ -43,8 +43,8 @@ var CherryPick = NewIntegrationTest(NewIntegrationTestArgs{
43
43
Confirm ()
44
44
}).
45
45
Lines (
46
- Contains ("three" ). IsSelected () ,
47
- Contains ("one" ),
46
+ Contains ("three" ),
47
+ Contains ("one" ). IsSelected () ,
48
48
)
49
49
},
50
50
})
You can’t perform that action at this time.
0 commit comments