@@ -134,11 +134,14 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
134
134
{
135
135
struct replay_opts opts = REPLAY_OPTS_INIT ;
136
136
unsigned flags = 0 , keep_empty = 0 , rebase_merges = 0 , autosquash = 0 ;
137
- int abbreviate_commands = 0 , rebase_cousins = -1 ;
137
+ int abbreviate_commands = 0 , rebase_cousins = -1 , ret = 0 ;
138
138
const char * onto = NULL , * onto_name = NULL , * restrict_revision = NULL ,
139
139
* squash_onto = NULL , * upstream = NULL , * head_name = NULL ,
140
140
* switch_to = NULL , * cmd = NULL ;
141
141
char * raw_strategies = NULL ;
142
+ enum {
143
+ NONE = 0 , CONTINUE , SKIP , EDIT_TODO , SHOW_CURRENT_PATCH
144
+ } command = 0 ;
142
145
struct option options [] = {
143
146
OPT_BOOL (0 , "ff" , & opts .allow_ff , N_ ("allow fast-forward" )),
144
147
OPT_BOOL (0 , "keep-empty" , & keep_empty , N_ ("keep empty commits" )),
@@ -151,6 +154,13 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
151
154
N_ ("move commits that begin with squash!/fixup!" )),
152
155
OPT_BOOL (0 , "signoff" , & opts .signoff , N_ ("sign commits" )),
153
156
OPT__VERBOSE (& opts .verbose , N_ ("be verbose" )),
157
+ OPT_CMDMODE (0 , "continue" , & command , N_ ("continue rebase" ),
158
+ CONTINUE ),
159
+ OPT_CMDMODE (0 , "skip" , & command , N_ ("skip commit" ), SKIP ),
160
+ OPT_CMDMODE (0 , "edit-todo" , & command , N_ ("edit the todo list" ),
161
+ EDIT_TODO ),
162
+ OPT_CMDMODE (0 , "show-current-patch" , & command , N_ ("show the current patch" ),
163
+ SHOW_CURRENT_PATCH ),
154
164
OPT_STRING (0 , "onto" , & onto , N_ ("onto" ), N_ ("onto" )),
155
165
OPT_STRING (0 , "restrict-revision" , & restrict_revision ,
156
166
N_ ("restrict-revision" ), N_ ("restrict revision" )),
@@ -197,10 +207,39 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
197
207
warning (_ ("--[no-]rebase-cousins has no effect without "
198
208
"--rebase-merges" ));
199
209
200
- if (!onto && !upstream )
201
- die (_ ("a base commit must be provided with --upstream or --onto" ));
210
+ switch (command ) {
211
+ case NONE :
212
+ if (!onto && !upstream )
213
+ die (_ ("a base commit must be provided with --upstream or --onto" ));
214
+
215
+ ret = do_interactive_rebase (& opts , flags , switch_to , upstream , onto ,
216
+ onto_name , squash_onto , head_name , restrict_revision ,
217
+ raw_strategies , cmd , autosquash );
218
+ break ;
219
+ case SKIP : {
220
+ struct string_list merge_rr = STRING_LIST_INIT_DUP ;
221
+
222
+ rerere_clear (& merge_rr );
223
+ /* fallthrough */
224
+ case CONTINUE :
225
+ ret = sequencer_continue (& opts );
226
+ break ;
227
+ }
228
+ case EDIT_TODO :
229
+ ret = edit_todo_list (flags );
230
+ break ;
231
+ case SHOW_CURRENT_PATCH : {
232
+ struct child_process cmd = CHILD_PROCESS_INIT ;
233
+
234
+ cmd .git_cmd = 1 ;
235
+ argv_array_pushl (& cmd .args , "show" , "REBASE_HEAD" , "--" , NULL );
236
+ ret = run_command (& cmd );
237
+
238
+ break ;
239
+ }
240
+ default :
241
+ BUG ("invalid command '%d'" , command );
242
+ }
202
243
203
- return !!do_interactive_rebase (& opts , flags , switch_to , upstream , onto ,
204
- onto_name , squash_onto , head_name , restrict_revision ,
205
- raw_strategies , cmd , autosquash );
244
+ return !!ret ;
206
245
}
0 commit comments