@@ -482,12 +482,14 @@ static int allow_empty(struct replay_opts *opts, struct commit *commit)
482482
483483enum todo_command {
484484 TODO_PICK ,
485- TODO_REVERT
485+ TODO_REVERT ,
486+ TODO_NOOP
486487};
487488
488489static const char * todo_command_strings [] = {
489490 "pick" ,
490- "revert"
491+ "revert" ,
492+ "noop"
491493};
492494
493495static const char * command_to_string (const enum todo_command command )
@@ -744,6 +746,12 @@ static int parse_insn_line(struct todo_item *item,
744746 char * end_of_object_name ;
745747 int i , saved , status , padding ;
746748
749+ if (bol == eol || * bol == '\r' || * bol == comment_line_char ) {
750+ item -> command = TODO_NOOP ;
751+ item -> commit = NULL ;
752+ return 0 ;
753+ }
754+
747755 for (i = 0 ; i < ARRAY_SIZE (todo_command_strings ); i ++ )
748756 if (skip_prefix (bol , todo_command_strings [i ], & bol )) {
749757 item -> command = i ;
@@ -752,6 +760,11 @@ static int parse_insn_line(struct todo_item *item,
752760 if (i >= ARRAY_SIZE (todo_command_strings ))
753761 return error ("Invalid command: %.*s" , (int )(eol - bol ), bol );
754762
763+ if (item -> command == TODO_NOOP ) {
764+ item -> commit = NULL ;
765+ return 0 ;
766+ }
767+
755768 /* Eat up extra spaces/ tabs before object name */
756769 padding = strspn (bol , " \t" );
757770 if (!padding )
@@ -1056,7 +1069,12 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
10561069 struct todo_item * item = todo_list -> items + todo_list -> current ;
10571070 if (save_todo (todo_list , opts ))
10581071 return -1 ;
1059- res = do_pick_commit (item -> command , item -> commit , opts );
1072+ if (item -> command <= TODO_REVERT )
1073+ res = do_pick_commit (item -> command , item -> commit ,
1074+ opts );
1075+ else if (item -> command != TODO_NOOP )
1076+ return error ("Unknown command %d" , item -> command );
1077+
10601078 todo_list -> current ++ ;
10611079 if (res )
10621080 return res ;
0 commit comments