fix cherry-pick/revert status after commit
If the user commits a conflict resolution using `git commit` in the middle of a sequence of cherry-picks/reverts then `git status` missed the fact that a cherry-pick/revert is still in progress. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b07d9bfd17
commit
4a72486de9
35
sequencer.c
35
sequencer.c
@ -2142,6 +2142,41 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,
|
||||
return !item->commit;
|
||||
}
|
||||
|
||||
int sequencer_get_last_command(struct repository *r, enum replay_action *action)
|
||||
{
|
||||
struct todo_item item;
|
||||
char *eol;
|
||||
const char *todo_file;
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
int ret = -1;
|
||||
|
||||
todo_file = git_path_todo_file();
|
||||
if (strbuf_read_file(&buf, todo_file, 0) < 0) {
|
||||
if (errno == ENOENT)
|
||||
return -1;
|
||||
else
|
||||
return error_errno("unable to open '%s'", todo_file);
|
||||
}
|
||||
eol = strchrnul(buf.buf, '\n');
|
||||
if (buf.buf != eol && eol[-1] == '\r')
|
||||
eol--; /* strip Carriage Return */
|
||||
if (parse_insn_line(r, &item, buf.buf, eol))
|
||||
goto fail;
|
||||
if (item.command == TODO_PICK)
|
||||
*action = REPLAY_PICK;
|
||||
else if (item.command == TODO_REVERT)
|
||||
*action = REPLAY_REVERT;
|
||||
else
|
||||
goto fail;
|
||||
|
||||
ret = 0;
|
||||
|
||||
fail:
|
||||
strbuf_release(&buf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int parse_insn_buffer(struct repository *r, char *buf,
|
||||
struct todo_list *todo_list)
|
||||
{
|
||||
|
Reference in New Issue
Block a user