summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-02-27 18:43:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-27 18:43:54 (GMT)
commitc1ab3b8a44149a8dfb8968a958b13ac9e8d9579a (patch)
treead13ad23ec4fdecbaaf7cb8a9c4e9729f2ec18cd /builtin
parent12accdc023f2b62109860cb745bdd1827b2c22de (diff)
parent30884c9afcd03aa7d9a0524fde3c96d2e29cf9a9 (diff)
downloadgit-c1ab3b8a44149a8dfb8968a958b13ac9e8d9579a.zip
git-c1ab3b8a44149a8dfb8968a958b13ac9e8d9579a.tar.gz
git-c1ab3b8a44149a8dfb8968a958b13ac9e8d9579a.tar.bz2
Merge branch 'ab/commit-m-with-fixup' into maint
"git commit --fixup" did not allow "-m<message>" option to be used at the same time; allow it to annotate resulting commit with more text. * ab/commit-m-with-fixup: commit: add support for --fixup <commit> -m"<extra message>" commit doc: document that -c, -C, -F and --fixup with -m error
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 1f11e39..4610e3d 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -701,7 +701,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
}
}
- if (have_option_m) {
+ if (have_option_m && !fixup_message) {
strbuf_addbuf(&sb, &message);
hook_arg1 = "message";
} else if (logfile && !strcmp(logfile, "-")) {
@@ -731,6 +731,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
ctx.output_encoding = get_commit_output_encoding();
format_commit_message(commit, "fixup! %s\n\n",
&sb, &ctx);
+ if (have_option_m)
+ strbuf_addbuf(&sb, &message);
hook_arg1 = "message";
} else if (!stat(git_path_merge_msg(), &statbuf)) {
/*
@@ -1197,8 +1199,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
f++;
if (f > 1)
die(_("Only one of -c/-C/-F/--fixup can be used."));
- if (have_option_m && f > 0)
- die((_("Option -m cannot be combined with -c/-C/-F/--fixup.")));
+ if (have_option_m && (edit_message || use_message || logfile))
+ die((_("Option -m cannot be combined with -c/-C/-F.")));
if (f || have_option_m)
template_file = NULL;
if (edit_message)