diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-03 01:30:44 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-03 01:30:44 +0300 |
commit | 2b9afea37207323d629953c639542c0e4c87e484 (patch) | |
tree | f1006df3853b67d87b9cf7a914424c7c0db15867 /builtin | |
parent | 87ece7ce1133ebc5d339cad5f6f92c02e5fc712d (diff) | |
parent | caafecfcf13e58b474c33db093c9deacd11ceb08 (diff) |
Merge branch 'js/rebase-merge-octopus'
"git rebase --rebase-merges" mode now handles octopus merges as
well.
* js/rebase-merge-octopus:
rebase --rebase-merges: adjust man page for octopus support
rebase --rebase-merges: add support for octopus merges
merge: allow reading the merge commit message from a file
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/merge.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/builtin/merge.c b/builtin/merge.c index 299a754259..77e1694a78 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -111,6 +111,35 @@ static int option_parse_message(const struct option *opt, return 0; } +static int option_read_message(struct parse_opt_ctx_t *ctx, + const struct option *opt, int unset) +{ + struct strbuf *buf = opt->value; + const char *arg; + + if (unset) + BUG("-F cannot be negated"); + + if (ctx->opt) { + arg = ctx->opt; + ctx->opt = NULL; + } else if (ctx->argc > 1) { + ctx->argc--; + arg = *++ctx->argv; + } else + return opterror(opt, "requires a value", 0); + + if (buf->len) + strbuf_addch(buf, '\n'); + if (ctx->prefix && !is_absolute_path(arg)) + arg = prefix_filename(ctx->prefix, arg); + if (strbuf_read_file(buf, arg, 0) < 0) + return error(_("could not read file '%s'"), arg); + have_message = 1; + + return 0; +} + static struct strategy *get_strategy(const char *name) { int i; @@ -228,6 +257,9 @@ static struct option builtin_merge_options[] = { OPT_CALLBACK('m', "message", &merge_msg, N_("message"), N_("merge commit message (for a non-fast-forward merge)"), option_parse_message), + { OPTION_LOWLEVEL_CALLBACK, 'F', "file", &merge_msg, N_("path"), + N_("read message from file"), PARSE_OPT_NONEG, + (parse_opt_cb *) option_read_message }, OPT__VERBOSITY(&verbosity), OPT_BOOL(0, "abort", &abort_current_merge, N_("abort the current in-progress merge")), |