@@ -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" )),
@@ -194,7 +204,36 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
194
204
warning (_ ("--[no-]rebase-cousins has no effect without "
195
205
"--rebase-merges" ));
196
206
197
- return !!do_interactive_rebase (& opts , flags , switch_to , upstream , onto ,
198
- onto_name , squash_onto , head_name , restrict_revision ,
199
- raw_strategies , cmd , autosquash );
207
+ switch (command ) {
208
+ case NONE :
209
+ ret = do_interactive_rebase (& opts , flags , switch_to , upstream , onto ,
210
+ onto_name , squash_onto , head_name , restrict_revision ,
211
+ raw_strategies , cmd , autosquash );
212
+ break ;
213
+ case SKIP : {
214
+ struct string_list merge_rr = STRING_LIST_INIT_DUP ;
215
+
216
+ rerere_clear (& merge_rr );
217
+ /* fallthrough */
218
+ case CONTINUE :
219
+ ret = sequencer_continue (& opts );
220
+ break ;
221
+ }
222
+ case EDIT_TODO :
223
+ ret = edit_todo_list (flags );
224
+ break ;
225
+ case SHOW_CURRENT_PATCH : {
226
+ struct child_process cmd = CHILD_PROCESS_INIT ;
227
+
228
+ cmd .git_cmd = 1 ;
229
+ argv_array_pushl (& cmd .args , "show" , "REBASE_HEAD" , "--" , NULL );
230
+ ret = run_command (& cmd );
231
+
232
+ break ;
233
+ }
234
+ default :
235
+ BUG ("invalid command '%d'" , command );
236
+ }
237
+
238
+ return !!ret ;
200
239
}
0 commit comments