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

Function error_with_patch

sequencer.c:3792–3844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3790}
3791
3792static 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
3846static int error_failed_squash(struct repository *r,
3847 struct commit *commit,

Callers 3

error_failed_squashFunction · 0.85
pick_one_commitFunction · 0.85
pick_commitsFunction · 0.85

Calls 8

file_existsFunction · 0.85
write_messageFunction · 0.85
errorFunction · 0.85
make_patchFunction · 0.85
intend_to_amendFunction · 0.85
gpg_sign_opt_quotedFunction · 0.85
fprintf_lnFunction · 0.85
short_commit_nameFunction · 0.70

Tested by

no test coverage detected