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
This commit is contained in:
Junio C Hamano
2022-01-05 14:01:29 -08:00
7 changed files with 67 additions and 5 deletions

View File

@ -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)