| 644 | } |
| 645 | |
| 646 | static 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 | |
| 684 | enum commit_msg_cleanup_mode get_cleanup_mode(const char *cleanup_arg, |
| 685 | int use_editor) |
no test coverage detected