| 5458 | } |
| 5459 | |
| 5460 | int sequencer_continue(struct repository *r, struct replay_opts *opts) |
| 5461 | { |
| 5462 | struct todo_list todo_list = TODO_LIST_INIT; |
| 5463 | int res; |
| 5464 | |
| 5465 | if (read_and_refresh_cache(r, opts)) |
| 5466 | return -1; |
| 5467 | |
| 5468 | if (read_populate_opts(opts)) |
| 5469 | return -1; |
| 5470 | if (is_rebase_i(opts)) { |
| 5471 | if ((res = read_populate_todo(r, &todo_list, opts))) |
| 5472 | goto release_todo_list; |
| 5473 | |
| 5474 | if (file_exists(rebase_path_dropped())) { |
| 5475 | if ((res = todo_list_check_against_backup(r, opts, |
| 5476 | &todo_list))) |
| 5477 | goto release_todo_list; |
| 5478 | |
| 5479 | unlink(rebase_path_dropped()); |
| 5480 | } |
| 5481 | |
| 5482 | if (commit_staged_changes(r, opts, &todo_list)) { |
| 5483 | res = -1; |
| 5484 | goto release_todo_list; |
| 5485 | } |
| 5486 | } else if (!file_exists(get_todo_path(opts))) |
| 5487 | return continue_single_pick(r, opts); |
| 5488 | else if ((res = read_populate_todo(r, &todo_list, opts))) |
| 5489 | goto release_todo_list; |
| 5490 | |
| 5491 | if (!is_rebase_i(opts)) { |
| 5492 | /* Verify that the conflict has been resolved */ |
| 5493 | if (refs_ref_exists(get_main_ref_store(r), |
| 5494 | "CHERRY_PICK_HEAD") || |
| 5495 | refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD")) { |
| 5496 | res = continue_single_pick(r, opts); |
| 5497 | if (res) |
| 5498 | goto release_todo_list; |
| 5499 | } |
| 5500 | if (index_differs_from(r, "HEAD", NULL, 0)) { |
| 5501 | res = error_dirty_index(r, opts); |
| 5502 | goto release_todo_list; |
| 5503 | } |
| 5504 | todo_list.current++; |
| 5505 | } else if (file_exists(rebase_path_stopped_sha())) { |
| 5506 | struct strbuf buf = STRBUF_INIT; |
| 5507 | struct object_id oid; |
| 5508 | |
| 5509 | if (read_oneliner(&buf, rebase_path_stopped_sha(), |
| 5510 | READ_ONELINER_SKIP_IF_EMPTY) && |
| 5511 | !get_oid_hex(buf.buf, &oid)) |
| 5512 | record_in_rewritten(&oid, peek_command(&todo_list, 0)); |
| 5513 | strbuf_release(&buf); |
| 5514 | } |
| 5515 | |
| 5516 | res = pick_commits(r, &todo_list, opts); |
| 5517 | release_todo_list: |
no test coverage detected