MCPcopy Create free account
hub / github.com/git/git / complete_action

Function complete_action

sequencer.c:6557–6655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6555}
6556
6557int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags,
6558 const char *shortrevisions, const char *onto_name,
6559 struct commit *onto, const struct object_id *orig_head,
6560 struct string_list *commands, unsigned autosquash,
6561 unsigned update_refs,
6562 struct todo_list *todo_list)
6563{
6564 char shortonto[GIT_MAX_HEXSZ + 1];
6565 const char *todo_file = rebase_path_todo();
6566 struct todo_list new_todo = TODO_LIST_INIT;
6567 struct strbuf *buf = &todo_list->buf, buf2 = STRBUF_INIT;
6568 struct object_id oid = onto->object.oid;
6569 int res;
6570
6571 repo_find_unique_abbrev_r(r, shortonto, &oid,
6572 DEFAULT_ABBREV);
6573
6574 if (buf->len == 0) {
6575 struct todo_item *item = append_new_todo(todo_list);
6576 item->command = TODO_NOOP;
6577 item->commit = NULL;
6578 item->arg_len = item->arg_offset = item->flags = item->offset_in_buf = 0;
6579 }
6580
6581 if (update_refs && todo_list_add_update_ref_commands(todo_list))
6582 return -1;
6583
6584 if (autosquash && todo_list_rearrange_squash(todo_list))
6585 return -1;
6586
6587 if (commands->nr)
6588 todo_list_add_exec_commands(todo_list, commands);
6589
6590 if (count_commands(todo_list) == 0) {
6591 apply_autostash(rebase_path_autostash());
6592 sequencer_remove_state(opts);
6593
6594 return error(_("nothing to do"));
6595 }
6596
6597 res = edit_todo_list(r, opts, todo_list, &new_todo, shortrevisions,
6598 shortonto, flags);
6599 if (res == -1)
6600 return -1;
6601 else if (res == -2) {
6602 apply_autostash(rebase_path_autostash());
6603 sequencer_remove_state(opts);
6604
6605 return -1;
6606 } else if (res == -3) {
6607 apply_autostash(rebase_path_autostash());
6608 sequencer_remove_state(opts);
6609 todo_list_release(&new_todo);
6610
6611 return error(_("nothing to do"));
6612 } else if (res == -4) {
6613 checkout_onto(r, opts, onto_name, &onto->object.oid, orig_head);
6614 todo_list_release(&new_todo);

Callers 1

do_interactive_rebaseFunction · 0.85

Calls 15

append_new_todoFunction · 0.85
count_commandsFunction · 0.85
apply_autostashFunction · 0.85
sequencer_remove_stateFunction · 0.85
errorFunction · 0.85
edit_todo_listFunction · 0.85
todo_list_releaseFunction · 0.85
checkout_ontoFunction · 0.85

Tested by

no test coverage detected