| 2825 | } |
| 2826 | |
| 2827 | int sequencer_get_last_command(struct repository *r UNUSED, enum replay_action *action) |
| 2828 | { |
| 2829 | const char *todo_file, *bol; |
| 2830 | struct strbuf buf = STRBUF_INIT; |
| 2831 | int ret = 0; |
| 2832 | |
| 2833 | todo_file = git_path_todo_file(); |
| 2834 | if (strbuf_read_file(&buf, todo_file, 0) < 0) { |
| 2835 | if (errno == ENOENT || errno == ENOTDIR) |
| 2836 | return -1; |
| 2837 | else |
| 2838 | return error_errno("unable to open '%s'", todo_file); |
| 2839 | } |
| 2840 | bol = buf.buf + strspn(buf.buf, " \t\r\n"); |
| 2841 | if (is_command(TODO_PICK, &bol) && (*bol == ' ' || *bol == '\t')) |
| 2842 | *action = REPLAY_PICK; |
| 2843 | else if (is_command(TODO_REVERT, &bol) && |
| 2844 | (*bol == ' ' || *bol == '\t')) |
| 2845 | *action = REPLAY_REVERT; |
| 2846 | else |
| 2847 | ret = -1; |
| 2848 | |
| 2849 | strbuf_release(&buf); |
| 2850 | |
| 2851 | return ret; |
| 2852 | } |
| 2853 | |
| 2854 | int todo_list_parse_insn_buffer(struct repository *r, struct replay_opts *opts, |
| 2855 | char *buf, struct todo_list *todo_list) |
no test coverage detected