| 3790 | } |
| 3791 | |
| 3792 | static int error_with_patch(struct repository *r, |
| 3793 | struct commit *commit, |
| 3794 | const char *subject, int subject_len, |
| 3795 | struct replay_opts *opts, |
| 3796 | int exit_code, int to_amend) |
| 3797 | { |
| 3798 | struct replay_ctx *ctx = opts->ctx; |
| 3799 | |
| 3800 | /* |
| 3801 | * Write the commit message to be used by "git rebase |
| 3802 | * --continue". If a "fixup" or "squash" command has conflicts |
| 3803 | * then we will have already written rebase_path_message() in |
| 3804 | * error_failed_squash(). If an "edit" command was |
| 3805 | * fast-forwarded then we don't have a message in ctx->message |
| 3806 | * and rely on make_patch() to write rebase_path_message() |
| 3807 | * instead. |
| 3808 | */ |
| 3809 | if (ctx->have_message && !file_exists(rebase_path_message()) && |
| 3810 | write_message(ctx->message.buf, ctx->message.len, |
| 3811 | rebase_path_message(), 0)) |
| 3812 | return error(_("could not write commit message file")); |
| 3813 | |
| 3814 | if (commit && make_patch(r, commit, opts)) |
| 3815 | return -1; |
| 3816 | |
| 3817 | if (to_amend) { |
| 3818 | if (intend_to_amend()) |
| 3819 | return -1; |
| 3820 | |
| 3821 | fprintf(stderr, |
| 3822 | _("You can amend the commit now, with\n" |
| 3823 | "\n" |
| 3824 | " git commit --amend %s\n" |
| 3825 | "\n" |
| 3826 | "Once you are satisfied with your changes, run\n" |
| 3827 | "\n" |
| 3828 | " git rebase --continue\n"), |
| 3829 | gpg_sign_opt_quoted(opts)); |
| 3830 | } else if (exit_code) { |
| 3831 | if (commit) |
| 3832 | fprintf_ln(stderr, _("Could not apply %s... %.*s"), |
| 3833 | short_commit_name(r, commit), subject_len, subject); |
| 3834 | else |
| 3835 | /* |
| 3836 | * We don't have the hash of the parent so |
| 3837 | * just print the line from the todo file. |
| 3838 | */ |
| 3839 | fprintf_ln(stderr, _("Could not merge %.*s"), |
| 3840 | subject_len, subject); |
| 3841 | } |
| 3842 | |
| 3843 | return exit_code; |
| 3844 | } |
| 3845 | |
| 3846 | static int error_failed_squash(struct repository *r, |
| 3847 | struct commit *commit, |
no test coverage detected