@@ -1510,32 +1510,6 @@ static int allow_empty(struct repository *r,
1510
1510
return 1 ;
1511
1511
}
1512
1512
1513
- /*
1514
- * Note that ordering matters in this enum. Not only must it match the mapping
1515
- * below, it is also divided into several sections that matter. When adding
1516
- * new commands, make sure you add it in the right section.
1517
- */
1518
- enum todo_command {
1519
- /* commands that handle commits */
1520
- TODO_PICK = 0 ,
1521
- TODO_REVERT ,
1522
- TODO_EDIT ,
1523
- TODO_REWORD ,
1524
- TODO_FIXUP ,
1525
- TODO_SQUASH ,
1526
- /* commands that do something else than handling a single commit */
1527
- TODO_EXEC ,
1528
- TODO_BREAK ,
1529
- TODO_LABEL ,
1530
- TODO_RESET ,
1531
- TODO_MERGE ,
1532
- /* commands that do nothing but are counted for reporting progress */
1533
- TODO_NOOP ,
1534
- TODO_DROP ,
1535
- /* comments (not counted for reporting progress) */
1536
- TODO_COMMENT
1537
- };
1538
-
1539
1513
static struct {
1540
1514
char c ;
1541
1515
const char * str ;
@@ -2012,26 +1986,7 @@ enum todo_item_flags {
2012
1986
TODO_EDIT_MERGE_MSG = 1
2013
1987
};
2014
1988
2015
- struct todo_item {
2016
- enum todo_command command ;
2017
- struct commit * commit ;
2018
- unsigned int flags ;
2019
- const char * arg ;
2020
- int arg_len ;
2021
- size_t offset_in_buf ;
2022
- };
2023
-
2024
- struct todo_list {
2025
- struct strbuf buf ;
2026
- struct todo_item * items ;
2027
- int nr , alloc , current ;
2028
- int done_nr , total_nr ;
2029
- struct stat_data stat ;
2030
- };
2031
-
2032
- #define TODO_LIST_INIT { STRBUF_INIT }
2033
-
2034
- static void todo_list_release (struct todo_list * todo_list )
1989
+ void todo_list_release (struct todo_list * todo_list )
2035
1990
{
2036
1991
strbuf_release (& todo_list -> buf );
2037
1992
FREE_AND_NULL (todo_list -> items );
@@ -2134,8 +2089,8 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,
2134
2089
return !item -> commit ;
2135
2090
}
2136
2091
2137
- static int parse_insn_buffer (struct repository * r , char * buf ,
2138
- struct todo_list * todo_list )
2092
+ int todo_list_parse_insn_buffer (struct repository * r , char * buf ,
2093
+ struct todo_list * todo_list )
2139
2094
{
2140
2095
struct todo_item * item ;
2141
2096
char * p = buf , * next_p ;
@@ -2234,7 +2189,7 @@ static int read_populate_todo(struct repository *r,
2234
2189
return error (_ ("could not stat '%s'" ), todo_file );
2235
2190
fill_stat_data (& todo_list -> stat , & st );
2236
2191
2237
- res = parse_insn_buffer (r , todo_list -> buf .buf , todo_list );
2192
+ res = todo_list_parse_insn_buffer (r , todo_list -> buf .buf , todo_list );
2238
2193
if (res ) {
2239
2194
if (is_rebase_i (opts ))
2240
2195
return error (_ ("please fix this using "
@@ -2265,7 +2220,7 @@ static int read_populate_todo(struct repository *r,
2265
2220
FILE * f = fopen_or_warn (rebase_path_msgtotal (), "w" );
2266
2221
2267
2222
if (strbuf_read_file (& done .buf , rebase_path_done (), 0 ) > 0 &&
2268
- !parse_insn_buffer (r , done .buf .buf , & done ))
2223
+ !todo_list_parse_insn_buffer (r , done .buf .buf , & done ))
2269
2224
todo_list -> done_nr = count_commands (& done );
2270
2225
else
2271
2226
todo_list -> done_nr = 0 ;
@@ -4556,7 +4511,7 @@ int sequencer_add_exec_commands(struct repository *r,
4556
4511
if (strbuf_read_file (& todo_list .buf , todo_file , 0 ) < 0 )
4557
4512
return error (_ ("could not read '%s'." ), todo_file );
4558
4513
4559
- if (parse_insn_buffer (r , todo_list .buf .buf , & todo_list )) {
4514
+ if (todo_list_parse_insn_buffer (r , todo_list .buf .buf , & todo_list )) {
4560
4515
todo_list_release (& todo_list );
4561
4516
return error (_ ("unusable todo list: '%s'" ), todo_file );
4562
4517
}
@@ -4612,7 +4567,7 @@ int transform_todos(struct repository *r, unsigned flags)
4612
4567
if (strbuf_read_file (& todo_list .buf , todo_file , 0 ) < 0 )
4613
4568
return error (_ ("could not read '%s'." ), todo_file );
4614
4569
4615
- if (parse_insn_buffer (r , todo_list .buf .buf , & todo_list )) {
4570
+ if (todo_list_parse_insn_buffer (r , todo_list .buf .buf , & todo_list )) {
4616
4571
todo_list_release (& todo_list );
4617
4572
return error (_ ("unusable todo list: '%s'" ), todo_file );
4618
4573
}
@@ -4698,7 +4653,7 @@ int check_todo_list(struct repository *r)
4698
4653
goto leave_check ;
4699
4654
}
4700
4655
advise_to_edit_todo = res =
4701
- parse_insn_buffer (r , todo_list .buf .buf , & todo_list );
4656
+ todo_list_parse_insn_buffer (r , todo_list .buf .buf , & todo_list );
4702
4657
4703
4658
if (res || check_level == MISSING_COMMIT_CHECK_IGNORE )
4704
4659
goto leave_check ;
@@ -4717,7 +4672,7 @@ int check_todo_list(struct repository *r)
4717
4672
goto leave_check ;
4718
4673
}
4719
4674
strbuf_release (& todo_file );
4720
- res = !!parse_insn_buffer (r , todo_list .buf .buf , & todo_list );
4675
+ res = !!todo_list_parse_insn_buffer (r , todo_list .buf .buf , & todo_list );
4721
4676
4722
4677
/* Find commits in git-rebase-todo.backup yet unseen */
4723
4678
for (i = todo_list .nr - 1 ; i >= 0 ; i -- ) {
@@ -4799,7 +4754,7 @@ static int skip_unnecessary_picks(struct repository *r, struct object_id *output
4799
4754
4800
4755
if (strbuf_read_file_or_whine (& todo_list .buf , todo_file ) < 0 )
4801
4756
return -1 ;
4802
- if (parse_insn_buffer (r , todo_list .buf .buf , & todo_list ) < 0 ) {
4757
+ if (todo_list_parse_insn_buffer (r , todo_list .buf .buf , & todo_list ) < 0 ) {
4803
4758
todo_list_release (& todo_list );
4804
4759
return -1 ;
4805
4760
}
@@ -4887,7 +4842,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
4887
4842
if (strbuf_read_file (buf , todo_file , 0 ) < 0 )
4888
4843
return error_errno (_ ("could not read '%s'." ), todo_file );
4889
4844
4890
- if (parse_insn_buffer (r , buf -> buf , & todo_list )) {
4845
+ if (todo_list_parse_insn_buffer (r , buf -> buf , & todo_list )) {
4891
4846
todo_list_release (& todo_list );
4892
4847
return error (_ ("unusable todo list: '%s'" ), todo_file );
4893
4848
}
@@ -4995,7 +4950,7 @@ int rearrange_squash(struct repository *r)
4995
4950
4996
4951
if (strbuf_read_file_or_whine (& todo_list .buf , todo_file ) < 0 )
4997
4952
return -1 ;
4998
- if (parse_insn_buffer (r , todo_list .buf .buf , & todo_list ) < 0 ) {
4953
+ if (todo_list_parse_insn_buffer (r , todo_list .buf .buf , & todo_list ) < 0 ) {
4999
4954
todo_list_release (& todo_list );
5000
4955
return -1 ;
5001
4956
}
0 commit comments