diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-20 12:41:33 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-20 12:41:33 -0700 |
commit | 5a5c5e95653f8db61ca9d1a30159dcf5dc4a8d6a (patch) | |
tree | 5e007fc315fb147b9cd06ec40a4a0f67b2f88077 /sequencer.c | |
parent | 36fd1e843b83a1ee10178e7da19eee3dee590580 (diff) | |
parent | bc9238bb0910f6d21e021e5c3061bf2124c3a176 (diff) | |
download | git-5a5c5e95653f8db61ca9d1a30159dcf5dc4a8d6a.tar.gz |
Merge branch 'pw/rebase-i-merge-segv-fix'
"git rebase -i", when a 'merge <branch>' insn in its todo list
fails, segfaulted, which has been (minimally) corrected.
* pw/rebase-i-merge-segv-fix:
rebase -i: fix SIGSEGV when 'merge <branch>' fails
t3430: add conflicting commit
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/sequencer.c b/sequencer.c index 2db52fe800..65d371c746 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2610,8 +2610,13 @@ static int error_with_patch(struct commit *commit, const char *subject, int subject_len, struct replay_opts *opts, int exit_code, int to_amend) { - if (make_patch(commit, opts)) - return -1; + if (commit) { + if (make_patch(commit, opts)) + return -1; + } else if (copy_file(rebase_path_message(), + git_path_merge_msg(the_repository), 0666)) + return error(_("unable to copy '%s' to '%s'"), + git_path_merge_msg(the_repository), rebase_path_message()); if (to_amend) { if (intend_to_amend()) @@ -2626,9 +2631,18 @@ static int error_with_patch(struct commit *commit, "\n" " git rebase --continue\n"), gpg_sign_opt_quoted(opts)); - } else if (exit_code) - fprintf_ln(stderr, _("Could not apply %s... %.*s"), - short_commit_name(commit), subject_len, subject); + } else if (exit_code) { + if (commit) + fprintf_ln(stderr, _("Could not apply %s... %.*s"), + short_commit_name(commit), subject_len, subject); + else + /* + * We don't have the hash of the parent so + * just print the line from the todo file. + */ + fprintf_ln(stderr, _("Could not merge %.*s"), + subject_len, subject); + } return exit_code; } |