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

Function fast_forward_to

sequencer.c:646–682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

644}
645
646static int fast_forward_to(struct repository *r,
647 const struct object_id *to,
648 const struct object_id *from,
649 int unborn,
650 struct replay_opts *opts)
651{
652 struct ref_transaction *transaction;
653 struct strbuf sb = STRBUF_INIT;
654 struct strbuf err = STRBUF_INIT;
655
656 repo_read_index(r);
657 if (checkout_fast_forward(r, from, to, 1))
658 return -1; /* the callee should have complained already */
659
660 strbuf_addf(&sb, "%s: fast-forward", action_name(opts));
661
662 transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
663 0, &err);
664 if (!transaction ||
665 ref_transaction_update(transaction, "HEAD",
666 to, unborn && !is_rebase_i(opts) ?
667 null_oid(the_hash_algo) : from, NULL, NULL,
668 0, sb.buf, &err) ||
669 ref_transaction_commit(transaction, &err)) {
670 ref_transaction_free(transaction);
671 error("%s", err.buf);
672 strbuf_release(&sb);
673 strbuf_release(&err);
674 return -1;
675 }
676
677 strbuf_release(&sb);
678 strbuf_release(&err);
679 ref_transaction_free(transaction);
680 update_abort_safety_file();
681 return 0;
682}
683
684enum commit_msg_cleanup_mode get_cleanup_mode(const char *cleanup_arg,
685 int use_editor)

Callers 2

do_pick_commitFunction · 0.70
do_mergeFunction · 0.70

Calls 14

repo_read_indexFunction · 0.85
checkout_fast_forwardFunction · 0.85
strbuf_addfFunction · 0.85
get_main_ref_storeFunction · 0.85
ref_transaction_updateFunction · 0.85
is_rebase_iFunction · 0.85
null_oidFunction · 0.85
ref_transaction_commitFunction · 0.85
ref_transaction_freeFunction · 0.85
errorFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected