@@ -43,7 +43,7 @@ static char const * const builtin_rebase_usage[] = {
4343 "[--onto <newbase> | --keep-base] [<upstream> [<branch>]]" ),
4444 N_ ("git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] "
4545 "--root [<branch>]" ),
46- "git rebase --continue | --abort | --skip | --edit-todo" ,
46+ "git rebase --continue [--[no-]edit] | --abort | --skip | --edit-todo" ,
4747 NULL
4848};
4949
@@ -135,6 +135,8 @@ struct rebase_options {
135135 int config_autosquash ;
136136 int config_rebase_merges ;
137137 int config_update_refs ;
138+ int config_no_edit ;
139+ int edit ;
138140};
139141
140142#define REBASE_OPTIONS_INIT { \
@@ -156,6 +158,8 @@ struct rebase_options {
156158 .update_refs = -1, \
157159 .config_update_refs = -1, \
158160 .strategy_opts = STRING_LIST_INIT_NODUP,\
161+ .config_no_edit = -1, \
162+ .edit = -1, \
159163 }
160164
161165static void rebase_options_release (struct rebase_options * opts )
@@ -215,6 +219,13 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)
215219 replay .have_squash_onto = 1 ;
216220 }
217221
222+ if (opts -> action == ACTION_CONTINUE ) {
223+ if (opts -> edit >= 0 )
224+ replay .edit = opts -> edit ;
225+ else if (opts -> config_no_edit > 0 )
226+ replay .edit = 0 ;
227+ }
228+
218229 return replay ;
219230}
220231
@@ -839,6 +850,11 @@ static int rebase_config(const char *var, const char *value,
839850 return 0 ;
840851 }
841852
853+ if (!strcmp (var , "rebase.noedit" )) {
854+ opts -> config_no_edit = git_config_bool (var , value );
855+ return 0 ;
856+ }
857+
842858 if (!strcmp (var , "rebase.forkpoint" )) {
843859 opts -> fork_point = git_config_bool (var , value ) ? -1 : 0 ;
844860 return 0 ;
@@ -1168,6 +1184,8 @@ int cmd_rebase(int argc,
11681184 ACTION_CONTINUE ),
11691185 OPT_CMDMODE (0 , "skip" , & options .action ,
11701186 N_ ("skip current patch and continue" ), ACTION_SKIP ),
1187+ OPT_BOOL ('e' , "edit" , & options .edit ,
1188+ N_ ("edit the commit message" )),
11711189 OPT_CMDMODE (0 , "abort" , & options .action ,
11721190 N_ ("abort and check out the original branch" ),
11731191 ACTION_ABORT ),
@@ -1308,10 +1326,15 @@ int cmd_rebase(int argc,
13081326 "which is no longer supported; use 'merges' instead" ));
13091327
13101328 if (options .action != ACTION_NONE && total_argc != 2 ) {
1311- usage_with_options (builtin_rebase_usage ,
1312- builtin_rebase_options );
1329+ if (options .action != ACTION_CONTINUE ||
1330+ options .edit < 0 || total_argc != 3 )
1331+ usage_with_options (builtin_rebase_usage ,
1332+ builtin_rebase_options );
13131333 }
13141334
1335+ if (options .edit >= 0 && options .action != ACTION_CONTINUE )
1336+ die (_ ("--edit and --no-edit can only be used with --continue" ));
1337+
13151338 if (argc > 2 )
13161339 usage_with_options (builtin_rebase_usage ,
13171340 builtin_rebase_options );
0 commit comments