| 4904 | } |
| 4905 | |
| 4906 | static 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 | |
| 4930 | static const char rescheduled_advice[] = |
| 4931 | N_("Could not execute the todo command\n" |
no test coverage detected