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

Function pick_one_commit

sequencer.c:4941–4998  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4939" git rebase --continue\n");
4940
4941static int pick_one_commit(struct repository *r,
4942 struct todo_list *todo_list,
4943 struct replay_opts *opts,
4944 int *check_todo, int* reschedule)
4945{
4946 int res;
4947 struct todo_item *item = todo_list->items + todo_list->current;
4948 const char *arg = todo_item_get_arg(todo_list, item);
4949
4950 res = do_pick_commit(r, item, opts, is_final_fixup(todo_list),
4951 check_todo);
4952 if (is_rebase_i(opts) && res < 0) {
4953 /* Reschedule */
4954 *reschedule = 1;
4955 return -1;
4956 }
4957 if (item->command == TODO_EDIT) {
4958 struct commit *commit = item->commit;
4959 if (!res) {
4960 if (!opts->verbose)
4961 term_clear_line();
4962 fprintf(stderr, _("Stopped at %s... %.*s\n"),
4963 short_commit_name(r, commit), item->arg_len, arg);
4964 }
4965 return error_with_patch(r, commit,
4966 arg, item->arg_len, opts, res, !res);
4967 }
4968 if (is_rebase_i(opts) && !res)
4969 record_in_rewritten(&item->commit->object.oid,
4970 peek_command(todo_list, 1));
4971 if (res && is_fixup(item->command)) {
4972 if (res == 1)
4973 intend_to_amend();
4974 return error_failed_squash(r, item->commit, opts,
4975 item->arg_len, arg);
4976 } else if (res && is_rebase_i(opts) && item->commit) {
4977 int to_amend = 0;
4978 struct object_id oid;
4979
4980 /*
4981 * If we are rewording and have either
4982 * fast-forwarded already, or are about to
4983 * create a new root commit, we want to amend,
4984 * otherwise we do not.
4985 */
4986 if (item->command == TODO_REWORD &&
4987 !repo_get_oid(r, "HEAD", &oid) &&
4988 (oideq(&item->commit->object.oid, &oid) ||
4989 (opts->have_squash_onto &&
4990 oideq(&opts->squash_onto, &oid))))
4991 to_amend = 1;
4992
4993 return res | error_with_patch(r, item->commit,
4994 arg, item->arg_len, opts,
4995 res, to_amend);
4996 }
4997 return res;
4998}

Callers 1

pick_commitsFunction · 0.85

Calls 14

todo_item_get_argFunction · 0.85
do_pick_commitFunction · 0.85
is_final_fixupFunction · 0.85
is_rebase_iFunction · 0.85
term_clear_lineFunction · 0.85
error_with_patchFunction · 0.85
record_in_rewrittenFunction · 0.85
peek_commandFunction · 0.85
is_fixupFunction · 0.85
intend_to_amendFunction · 0.85
error_failed_squashFunction · 0.85
repo_get_oidFunction · 0.85

Tested by

no test coverage detected