summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-02-27 23:31:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-02-27 23:31:50 (GMT)
commit4eed30a7cb56dfd21917a3685eccb1d8321d852f (patch)
treefe0f1e322a72cc805d11b93e628ecf0ba8db9d5c /builtin
parent860f70f9f4206379361fd5af84c8fde31984b418 (diff)
parentf26af3fcbcbd27392b8c94b1e4eb6e671b2466ab (diff)
downloadgit-4eed30a7cb56dfd21917a3685eccb1d8321d852f.zip
git-4eed30a7cb56dfd21917a3685eccb1d8321d852f.tar.gz
git-4eed30a7cb56dfd21917a3685eccb1d8321d852f.tar.bz2
Merge branch 'tr/merge-edit-guidance' into maint
* tr/merge-edit-guidance: merge: add instructions to the commit message when editing
Diffstat (limited to 'builtin')
-rw-r--r--builtin/merge.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index f385b8a..8018a14 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -885,11 +885,21 @@ static void abort_commit(const char *err_msg)
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)
{
struct strbuf msg = STRBUF_INIT;
+ const char *comment = _(merge_editor_comment);
strbuf_addbuf(&msg, &merge_msg);
strbuf_addch(&msg, '\n');
+ if (0 < option_edit)
+ strbuf_add_lines(&msg, "# ", comment, strlen(comment));
write_merge_msg(&msg);
run_hook(get_index_file(), "prepare-commit-msg",
git_path("MERGE_MSG"), "merge", NULL, NULL);