Merge branch 'tr/merge-edit-guidance' into maint
* tr/merge-edit-guidance: merge: add instructions to the commit message when editingmaint
commit
4eed30a7cb
|
@ -885,11 +885,21 @@ static void abort_commit(const char *err_msg)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char merge_editor_comment[] =
|
||||||
|
N_("Please enter a commit message to explain why this merge is necessary,\n"
|
||||||
|
"especially if it merges an updated upstream into a topic branch.\n"
|
||||||
|
"\n"
|
||||||
|
"Lines starting with '#' will be ignored, and an empty message aborts\n"
|
||||||
|
"the commit.\n");
|
||||||
|
|
||||||
static void prepare_to_commit(void)
|
static void prepare_to_commit(void)
|
||||||
{
|
{
|
||||||
struct strbuf msg = STRBUF_INIT;
|
struct strbuf msg = STRBUF_INIT;
|
||||||
|
const char *comment = _(merge_editor_comment);
|
||||||
strbuf_addbuf(&msg, &merge_msg);
|
strbuf_addbuf(&msg, &merge_msg);
|
||||||
strbuf_addch(&msg, '\n');
|
strbuf_addch(&msg, '\n');
|
||||||
|
if (0 < option_edit)
|
||||||
|
strbuf_add_lines(&msg, "# ", comment, strlen(comment));
|
||||||
write_merge_msg(&msg);
|
write_merge_msg(&msg);
|
||||||
run_hook(get_index_file(), "prepare-commit-msg",
|
run_hook(get_index_file(), "prepare-commit-msg",
|
||||||
git_path("MERGE_MSG"), "merge", NULL, NULL);
|
git_path("MERGE_MSG"), "merge", NULL, NULL);
|
||||||
|
|
Loading…
Reference in New Issue