summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1876166)
raw | patch | inline | side by side (parent: 1876166)
author | Ramkumar Ramachandra <artagnon@gmail.com> | |
Wed, 8 Sep 2010 17:59:54 +0000 (23:29 +0530) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 9 Sep 2010 18:39:20 +0000 (11:39 -0700) |
Change the command-line '--log' option from a boolean option to an
integer option, and parse the optional integer provided on the
command-line into the 'shortlog_len' variable. Also update the
documentation accordingly.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reported-by: Yaroslav Halchenko <debian@onerussian.com>
Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
Thanks-to: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
integer option, and parse the optional integer provided on the
command-line into the 'shortlog_len' variable. Also update the
documentation accordingly.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reported-by: Yaroslav Halchenko <debian@onerussian.com>
Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
Thanks-to: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-fmt-merge-msg.txt | patch | blob | history | |
Documentation/merge-options.txt | patch | blob | history | |
builtin/fmt-merge-msg.c | patch | blob | history | |
builtin/merge.c | patch | blob | history |
index 302f56b88941cfaa002a8b75c078335bf8d86276..f04a9ff0e0299bdb6f33d10f5674cc19dc2777f7 100644 (file)
SYNOPSIS
--------
[verse]
-'git fmt-merge-msg' [-m <message>] [--log | --no-log] <$GIT_DIR/FETCH_HEAD
-'git fmt-merge-msg' [-m <message>] [--log | --no-log] -F <file>
+'git fmt-merge-msg' [-m <message>] [--log[=<n>] | --no-log] <$GIT_DIR/FETCH_HEAD
+'git fmt-merge-msg' [-m <message>] [--log[=<n>] | --no-log] -F <file>
DESCRIPTION
-----------
OPTIONS
-------
---log::
+--log[=<n>]::
In addition to branch names, populate the log message with
one-line descriptions from the actual commits that are being
- merged.
+ merged. At most <n> commits from each merge parent will be
+ used (20 if <n> is omitted). This overrides the `merge.log`
+ configuration variable.
--no-log::
Do not list one-line descriptions from the actual commits being
index 722d704ff2de1abd3d77a18ca396ba96d5cab6bc..e33e0f8e110879a0cd6fe81d97ee6044290e5cfa 100644 (file)
With --no-ff Generate a merge commit even if the merge
resolved as a fast-forward.
---log::
+--log[=<n>]::
--no-log::
In addition to branch names, populate the log message with
- one-line descriptions from the actual commits that are being
- merged.
+ one-line descriptions from at most <n> actual commits that are being
+ merged. See also linkgit:git-fmt-merge-msg[1].
+
With --no-log do not list one-line descriptions from the
actual commits being merged.
index 42021d327e4278439f078a84c5fe73a82e0e4b22..455e7c67f885e7a8584066fca6f759ddd27443db 100644 (file)
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
#include "string-list.h"
static const char * const fmt_merge_msg_usage[] = {
- "git fmt-merge-msg [-m <message>] [--log|--no-log] [--file <file>]",
+ "git fmt-merge-msg [-m <message>] [--log[=<n>]|--no-log] [--file <file>]",
NULL
};
-static int merge_summary;
+static int shortlog_len;
static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
{
static int found_merge_log = 0;
if (!strcmp("merge.log", key)) {
found_merge_log = 1;
- merge_summary = git_config_bool(key, value);
+ shortlog_len = git_config_bool(key, value) ? DEFAULT_MERGE_LOG_LEN : 0;
+ return 0;
+ }
+ if (!found_merge_log && !strcmp("merge.summary", key)) {
+ shortlog_len = git_config_bool(key, value) ? DEFAULT_MERGE_LOG_LEN : 0;
+ return 0;
}
- if (!found_merge_log && !strcmp("merge.summary", key))
- merge_summary = git_config_bool(key, value);
return 0;
}
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,
+ { OPTION_INTEGER, 0, "log", &shortlog_len, "n",
+ "populate log with at most <n> entries from shortlog",
+ PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },
+ { OPTION_INTEGER, 0, "summary", &shortlog_len, "n",
"alias for --log (deprecated)",
- PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
+ PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL,
+ DEFAULT_MERGE_LOG_LEN },
OPT_STRING('m', "message", &message, "text",
"use <text> as start of message"),
OPT_FILENAME('F', "file", &inpath, "file to read from"),
0);
if (argc > 0)
usage_with_options(fmt_merge_msg_usage, options);
- if (message && !merge_summary) {
+ if (message && !shortlog_len) {
char nl = '\n';
write_in_full(STDOUT_FILENO, message, strlen(message));
write_in_full(STDOUT_FILENO, &nl, 1);
return 0;
}
+ if (shortlog_len < 0)
+ die("Negative --log=%d", shortlog_len);
if (inpath && strcmp(inpath, "-")) {
in = fopen(inpath, "r");
strbuf_addstr(&output, message);
ret = fmt_merge_msg(&input, &output,
message ? 0 : 1,
- merge_summary ? DEFAULT_MERGE_LOG_LEN : 0);
+ shortlog_len);
if (ret)
return ret;
diff --git a/builtin/merge.c b/builtin/merge.c
index b2c09848fdc2a49734307613cce6f3c48b2dd64e..9e4733d25f94a4185acb99cbc53255cee2654c1b 100644 (file)
--- a/builtin/merge.c
+++ b/builtin/merge.c
NULL
};
-static int show_diffstat = 1, option_log, squash;
+static int show_diffstat = 1, shortlog_len, squash;
static int option_commit = 1, allow_fast_forward = 1;
static int fast_forward_only;
static int allow_trivial = 1, have_message;
OPT_BOOLEAN(0, "stat", &show_diffstat,
"show a diffstat at the end of the merge"),
OPT_BOOLEAN(0, "summary", &show_diffstat, "(synonym to --stat)"),
- OPT_BOOLEAN(0, "log", &option_log,
- "add list of one-line log to merge commit message"),
+ { OPTION_INTEGER, 0, "log", &shortlog_len, "n",
+ "add (at most <n>) entries from shortlog to merge commit message",
+ PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },
OPT_BOOLEAN(0, "squash", &squash,
"create a single commit instead of doing a merge"),
OPT_BOOLEAN(0, "commit", &option_commit,
return git_config_string(&pull_twohead, k, v);
else if (!strcmp(k, "pull.octopus"))
return git_config_string(&pull_octopus, k, v);
- else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary"))
- option_log = git_config_bool(k, v);
+ else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary")) {
+ shortlog_len = git_config_bool(k, v) ? DEFAULT_MERGE_LOG_LEN : 0;
+ return 0;
+ }
return git_diff_ui_config(k, v, cb);
}
for (i = 0; i < argc; i++)
merge_name(argv[i], &merge_names);
- if (!have_message || option_log) {
+ if (!have_message || shortlog_len) {
fmt_merge_msg(&merge_names, &merge_msg, !have_message,
- option_log ? DEFAULT_MERGE_LOG_LEN : 0);
+ shortlog_len);
if (merge_msg.len)
strbuf_setlen(&merge_msg, merge_msg.len - 1);
}