diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-09-03 09:43:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-09-03 09:43:42 -0700 |
commit | 2b916ffa18cb163a9d8f0060a9127e9b0a84b955 (patch) | |
tree | c0aa695e824503a78d4f2791119dda4ac66674a0 /builtin/fmt-merge-msg.c | |
parent | Merge branch 'jn/merge-renormalize' (diff) | |
parent | merge script: learn --[no-]rerere-autoupdate (diff) | |
download | tgif-2b916ffa18cb163a9d8f0060a9127e9b0a84b955.tar.xz |
Merge branch 'jn/update-contrib-example-merge'
* jn/update-contrib-example-merge: (24 commits)
merge script: learn --[no-]rerere-autoupdate
merge script: notice @{-1} shorthand
merge script: handle --no-ff --no-commit correctly
merge script: --ff-only to disallow true merge
merge script: handle many-way octopus
merge script: handle -m --log correctly
merge script: forbid merge -s index
merge script: allow custom strategies
merge script: merge -X<option>
merge script: improve log message subject
merge script: refuse to merge during merge
merge script: tweak unmerged files message to match builtin
merge script: --squash, --ff from unborn branch are errors
fmt-merge-msg -m to override merge title
merge-base --independent to print reduced parent list in a merge
merge-base --octopus to mimic show-branch --merge-base
Documentation: add a SEE ALSO section for merge-base
t6200 (fmt-merge-msg): style nitpicks
t6010 (merge-base): modernize style
t7600 (merge): test merge from branch yet to be born
...
Diffstat (limited to 'builtin/fmt-merge-msg.c')
-rw-r--r-- | builtin/fmt-merge-msg.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index a76cd4e9d1..e7e12eea25 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -7,7 +7,7 @@ #include "string-list.h" static const char * const fmt_merge_msg_usage[] = { - "git fmt-merge-msg [--log|--no-log] [--file <file>]", + "git fmt-merge-msg [-m <message>] [--log|--no-log] [--file <file>]", NULL }; @@ -319,11 +319,14 @@ int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) { int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) { const char *inpath = NULL; + const char *message = NULL; struct option options[] = { OPT_BOOLEAN(0, "log", &merge_summary, "populate log with the shortlog"), { OPTION_BOOLEAN, 0, "summary", &merge_summary, NULL, "alias for --log (deprecated)", PARSE_OPT_NOARG | PARSE_OPT_HIDDEN }, + OPT_STRING('m', "message", &message, "text", + "use <text> as start of message"), OPT_FILENAME('F', "file", &inpath, "file to read from"), OPT_END() }; @@ -337,6 +340,12 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) 0); if (argc > 0) usage_with_options(fmt_merge_msg_usage, options); + if (message && !merge_summary) { + char nl = '\n'; + write_in_full(STDOUT_FILENO, message, strlen(message)); + write_in_full(STDOUT_FILENO, &nl, 1); + return 0; + } if (inpath && strcmp(inpath, "-")) { in = fopen(inpath, "r"); @@ -346,7 +355,12 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) if (strbuf_read(&input, fileno(in), 0) < 0) die_errno("could not read input file"); - ret = fmt_merge_msg(merge_summary, &input, &output); + if (message) { + strbuf_addstr(&output, message); + ret = fmt_merge_msg_shortlog(&input, &output); + } else { + ret = fmt_merge_msg(merge_summary, &input, &output); + } if (ret) return ret; write_in_full(STDOUT_FILENO, output.buf, output.len); |