MCPcopy Create free account
hub / github.com/git/git / reread_todo_if_changed

Function reread_todo_if_changed

sequencer.c:4906–4928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4904}
4905
4906static int reread_todo_if_changed(struct repository *r,
4907 struct todo_list *todo_list,
4908 struct replay_opts *opts)
4909{
4910 int offset;
4911 struct strbuf buf = STRBUF_INIT;
4912
4913 if (strbuf_read_file_or_whine(&buf, get_todo_path(opts)) < 0)
4914 return -1;
4915 offset = get_item_line_offset(todo_list, todo_list->current + 1);
4916 if (buf.len != todo_list->buf.len - offset ||
4917 memcmp(buf.buf, todo_list->buf.buf + offset, buf.len)) {
4918 /* Reread the todo file if it has changed. */
4919 todo_list_release(todo_list);
4920 if (read_populate_todo(r, todo_list, opts))
4921 return -1; /* message was printed */
4922 /* `current` will be incremented on return */
4923 todo_list->current = -1;
4924 }
4925 strbuf_release(&buf);
4926
4927 return 0;
4928}
4929
4930static const char rescheduled_advice[] =
4931N_("Could not execute the todo command\n"

Callers 1

pick_commitsFunction · 0.85

Calls 6

get_todo_pathFunction · 0.85
get_item_line_offsetFunction · 0.85
todo_list_releaseFunction · 0.85
read_populate_todoFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected