summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-01-05 14:01:29 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-01-05 14:01:30 -0800
commitbb14cfdfd74c37f4319405eaebce0691c5b51db0 (patch)
treeff830f599931dd6952e354ffd1ba0b2bedea8a76 /builtin
parentMerge branch 'km/help-prompt-fix' (diff)
parentmerge: allow to pretend a merge is made into a different branch (diff)
downloadtgif-bb14cfdfd74c37f4319405eaebce0691c5b51db0.tar.xz
Merge branch 'jc/merge-detached-head-name'
The default merge message prepared by "git merge" records the name of the current branch; the name can be overridden with a new option to allow users to pretend a merge is made on a different branch. * jc/merge-detached-head-name: merge: allow to pretend a merge is made into a different branch
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fmt-merge-msg.c4
-rw-r--r--builtin/merge.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 48a8699de7..8d8fd393f8 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -12,6 +12,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
{
const char *inpath = NULL;
const char *message = NULL;
+ char *into_name = NULL;
int shortlog_len = -1;
struct option options[] = {
{ OPTION_INTEGER, 0, "log", &shortlog_len, N_("n"),
@@ -23,6 +24,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
DEFAULT_MERGE_LOG_LEN },
OPT_STRING('m', "message", &message, N_("text"),
N_("use <text> as start of message")),
+ OPT_STRING(0, "into-name", &into_name, N_("name"),
+ N_("use <name> instead of the real target branch")),
OPT_FILENAME('F', "file", &inpath, N_("file to read from")),
OPT_END()
};
@@ -56,6 +59,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
opts.add_title = !message;
opts.credit_people = 1;
opts.shortlog_len = shortlog_len;
+ opts.into_name = into_name;
ret = fmt_merge_msg(&input, &output, &opts);
if (ret)
diff --git a/builtin/merge.c b/builtin/merge.c
index 5f0476b0b7..991de01bb4 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -87,6 +87,7 @@ static int signoff;
static const char *sign_commit;
static int autostash;
static int no_verify;
+static char *into_name;
static struct strategy all_strategy[] = {
{ "recursive", NO_TRIVIAL },
@@ -286,6 +287,8 @@ static struct option builtin_merge_options[] = {
{ OPTION_LOWLEVEL_CALLBACK, 'F', "file", &merge_msg, N_("path"),
N_("read message from file"), PARSE_OPT_NONEG,
NULL, 0, option_read_message },
+ OPT_STRING(0, "into-name", &into_name, N_("name"),
+ N_("use <name> instead of the real target")),
OPT__VERBOSITY(&verbosity),
OPT_BOOL(0, "abort", &abort_current_merge,
N_("abort the current in-progress merge")),
@@ -1121,6 +1124,7 @@ static void prepare_merge_message(struct strbuf *merge_names, struct strbuf *mer
opts.add_title = !have_message;
opts.shortlog_len = shortlog_len;
opts.credit_people = (0 < option_edit);
+ opts.into_name = into_name;
fmt_merge_msg(merge_names, merge_msg, &opts);
if (merge_msg->len)