MCPcopy Index your code
hub / github.com/git/git / todo_list_parse_insn_buffer

Function todo_list_parse_insn_buffer

sequencer.c:2854–2895  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2852}
2853
2854int todo_list_parse_insn_buffer(struct repository *r, struct replay_opts *opts,
2855 char *buf, struct todo_list *todo_list)
2856{
2857 struct todo_item *item;
2858 char *p = buf, *next_p;
2859 int i, res = 0, fixup_okay = file_exists(rebase_path_done());
2860
2861 todo_list->current = todo_list->nr = todo_list->total_nr = 0;
2862
2863 for (i = 1; *p; i++, p = next_p) {
2864 char *eol = strchrnul(p, '\n');
2865
2866 next_p = *eol ? eol + 1 /* skip LF */ : eol;
2867
2868 if (p != eol && eol[-1] == '\r')
2869 eol--; /* strip Carriage Return */
2870
2871 item = append_new_todo(todo_list);
2872 item->offset_in_buf = p - todo_list->buf.buf;
2873 if (parse_insn_line(r, opts, item, buf, p, eol)) {
2874 res = error(_("invalid line %d: %.*s"),
2875 i, (int)(eol - p), p);
2876 item->command = TODO_COMMENT + 1;
2877 item->arg_offset = p - buf;
2878 item->arg_len = (int)(eol - p);
2879 item->commit = NULL;
2880 }
2881
2882 if (item->command != TODO_COMMENT)
2883 todo_list->total_nr++;
2884
2885 if (fixup_okay)
2886 ; /* do nothing */
2887 else if (is_fixup(item->command))
2888 res = error(_("cannot '%s' without a previous commit"),
2889 command_to_string(item->command));
2890 else if (!is_noop(item->command))
2891 fixup_okay = 1;
2892 }
2893
2894 return res;
2895}
2896
2897static int count_commands(struct todo_list *todo_list)
2898{

Callers 5

edit_todo_listFunction · 0.85
read_populate_todoFunction · 0.85
complete_actionFunction · 0.85
do_interactive_rebaseFunction · 0.85

Calls 7

file_existsFunction · 0.85
append_new_todoFunction · 0.85
parse_insn_lineFunction · 0.85
errorFunction · 0.85
is_fixupFunction · 0.85
command_to_stringFunction · 0.85
is_noopFunction · 0.85

Tested by

no test coverage detected