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

Function sequencer_get_last_command

sequencer.c:2827–2852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2825}
2826
2827int 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
2854int todo_list_parse_insn_buffer(struct repository *r, struct replay_opts *opts,
2855 char *buf, struct todo_list *todo_list)

Callers 3

create_seq_dirFunction · 0.85
sequencer_skipFunction · 0.85
wt_status_get_stateFunction · 0.85

Calls 4

strbuf_read_fileFunction · 0.85
error_errnoFunction · 0.85
is_commandFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected