* [PATCH 0/4] fmt-merge-msg improvements
@ 2010-08-20 12:23 Ramkumar Ramachandra
2010-08-20 12:23 ` [PATCH 1/4] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 12:23 UTC (permalink / raw)
To: Git Mailing List; +Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko
Hi,
The first three parts make `merge.log` and `--log` an integer. While
at it, drop the deprecated `--summary` option: blame tells me that it
was marked deprecated back in 2008. The series is based on pu for no
good reason.
Thanks to Johannes and Jonathan for their inputs.
-- Ram
Ramkumar Ramachandra (4):
fmt-merge-msg: Make the number of log entries in commit message
configurable
fmt-merge-msg: Update command line options to sync with config
options
fmt-merge-msg: Update fmt-merge-msg and merge-config documentation
fmt-merge-msg: Remove deprecated --summary option
Documentation/git-fmt-merge-msg.txt | 28 +++++++----------------
Documentation/merge-config.txt | 8 +++++-
builtin/fmt-merge-msg.c | 41 ++++++++++++++++------------------
3 files changed, 34 insertions(+), 43 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] fmt-merge-msg: Make the number of log entries in commit message configurable
2010-08-20 12:23 [PATCH 0/4] fmt-merge-msg improvements Ramkumar Ramachandra
@ 2010-08-20 12:23 ` Ramkumar Ramachandra
2010-08-20 12:23 ` [PATCH 2/4] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 12:23 UTC (permalink / raw)
To: Git Mailing List; +Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko
Make the `merge.log` option either an integer or boolean instead of
just a boolean. The integer can be used to specify how many merged
commits to summarize (at maximum) in the merge message. Let true mean
20. Default to false.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reported-by: Yaroslav Halchenko <debian@onerussian.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>
Cc: Jonathan Nieder <jrnieder@gmail.com>
---
builtin/fmt-merge-msg.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index e7e12ee..66b1cbd 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -12,16 +12,23 @@ static const char * const fmt_merge_msg_usage[] = {
};
static int merge_summary;
+static int log_limit = 0;
static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
{
static int found_merge_log = 0;
+ int is_bool;
if (!strcmp("merge.log", key)) {
found_merge_log = 1;
- merge_summary = git_config_bool(key, value);
+ log_limit = git_config_bool_or_int(key, value, &is_bool);
}
if (!found_merge_log && !strcmp("merge.summary", key))
- merge_summary = git_config_bool(key, value);
+ log_limit = git_config_bool_or_int(key, value, &is_bool);
+
+ if (is_bool && log_limit)
+ log_limit = 20;
+ merge_summary = log_limit ? 1 : 0;
+
return 0;
}
@@ -140,7 +147,7 @@ static void print_joined(const char *singular, const char *plural,
}
static void shortlog(const char *name, unsigned char *sha1,
- struct commit *head, struct rev_info *rev, int limit,
+ struct commit *head, struct rev_info *rev,
struct strbuf *out)
{
int i, count = 0;
@@ -169,7 +176,7 @@ static void shortlog(const char *name, unsigned char *sha1,
continue;
count++;
- if (subjects.nr > limit)
+ if (subjects.nr > log_limit)
continue;
format_commit_message(commit, "%s", &sb, &ctx);
@@ -182,13 +189,13 @@ static void shortlog(const char *name, unsigned char *sha1,
string_list_append(&subjects, strbuf_detach(&sb, NULL));
}
- if (count > limit)
+ if (count > log_limit)
strbuf_addf(out, "\n* %s: (%d commits)\n", name, count);
else
strbuf_addf(out, "\n* %s:\n", name);
for (i = 0; i < subjects.nr; i++)
- if (i >= limit)
+ if (i >= log_limit)
strbuf_addf(out, " ...\n");
else
strbuf_addf(out, " %s\n", subjects.items[i].string);
@@ -257,7 +264,7 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
static int do_fmt_merge_msg(int merge_title, int merge_summary,
struct strbuf *in, struct strbuf *out) {
- int limit = 20, i = 0, pos = 0;
+ int i = 0, pos = 0;
unsigned char head_sha1[20];
const char *current_branch;
@@ -303,7 +310,7 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,
for (i = 0; i < origins.nr; i++)
shortlog(origins.items[i].string, origins.items[i].util,
- head, &rev, limit, out);
+ head, &rev, out);
}
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] fmt-merge-msg: Update command line options to sync with config options
2010-08-20 12:23 [PATCH 0/4] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-20 12:23 ` [PATCH 1/4] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
@ 2010-08-20 12:23 ` Ramkumar Ramachandra
2010-08-20 12:24 ` [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra
2010-08-20 12:24 ` [PATCH 4/4] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
3 siblings, 0 replies; 10+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 12:23 UTC (permalink / raw)
To: Git Mailing List; +Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko
Update the `--log` and `--summary` command line options to be integers
and have the same effect as the `merge.log` and `merge.summary`
configuration options.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>
Cc: Jonathan Nieder <jrnieder@gmail.com>
---
builtin/fmt-merge-msg.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 66b1cbd..67f24f8 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -11,7 +11,6 @@ static const char * const fmt_merge_msg_usage[] = {
NULL
};
-static int merge_summary;
static int log_limit = 0;
static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
@@ -27,7 +26,6 @@ static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
if (is_bool && log_limit)
log_limit = 20;
- merge_summary = log_limit ? 1 : 0;
return 0;
}
@@ -262,7 +260,7 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
strbuf_addf(out, " into %s\n", current_branch);
}
-static int do_fmt_merge_msg(int merge_title, int merge_summary,
+static int do_fmt_merge_msg(int merge_title, int log_limit,
struct strbuf *in, struct strbuf *out) {
int i = 0, pos = 0;
unsigned char head_sha1[20];
@@ -295,7 +293,7 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,
if (merge_title)
do_fmt_merge_msg_title(out, current_branch);
- if (merge_summary) {
+ if (log_limit) {
struct commit *head;
struct rev_info rev;
@@ -315,8 +313,8 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,
return 0;
}
-int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {
- return do_fmt_merge_msg(1, merge_summary, in, out);
+int fmt_merge_msg(int log_limit, struct strbuf *in, struct strbuf *out) {
+ return do_fmt_merge_msg(1, log_limit, in, out);
}
int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {
@@ -328,8 +326,9 @@ 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,
+ OPT_INTEGER(0, "log", &log_limit,
+ "populate log with <n> entries from shortlog"),
+ { OPTION_BOOLEAN, 0, "summary", &log_limit, NULL,
"alias for --log (deprecated)",
PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
OPT_STRING('m', "message", &message, "text",
@@ -347,7 +346,7 @@ 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) {
+ if (message && !log_limit) {
char nl = '\n';
write_in_full(STDOUT_FILENO, message, strlen(message));
write_in_full(STDOUT_FILENO, &nl, 1);
@@ -366,7 +365,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
strbuf_addstr(&output, message);
ret = fmt_merge_msg_shortlog(&input, &output);
} else {
- ret = fmt_merge_msg(merge_summary, &input, &output);
+ ret = fmt_merge_msg(log_limit, &input, &output);
}
if (ret)
return ret;
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation
2010-08-20 12:23 [PATCH 0/4] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-20 12:23 ` [PATCH 1/4] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
2010-08-20 12:23 ` [PATCH 2/4] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
@ 2010-08-20 12:24 ` Ramkumar Ramachandra
2010-08-20 12:39 ` Ramkumar Ramachandra
2010-08-20 12:24 ` [PATCH 4/4] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
3 siblings, 1 reply; 10+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 12:24 UTC (permalink / raw)
To: Git Mailing List; +Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko
Update the documentation of fmt-merge-msg and merge-config to reflect
the fact that `merge.log` can either be a boolean or integer option
now, instead of just a boolean.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>
Cc: Jonathan Nieder <jrnieder@gmail.com>
---
Documentation/git-fmt-merge-msg.txt | 24 +++++++++---------------
Documentation/merge-config.txt | 8 ++++++--
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt
index 302f56b..a930eeb 100644
--- a/Documentation/git-fmt-merge-msg.txt
+++ b/Documentation/git-fmt-merge-msg.txt
@@ -9,8 +9,8 @@ git-fmt-merge-msg - Produce a merge commit message
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>] < $GIT_DIR/FETCH_HEAD
+'git fmt-merge-msg' [-m <message>] [--log=<n>] -F <file>
DESCRIPTION
-----------
@@ -24,19 +24,10 @@ automatically invoking 'git merge'.
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.
-
---no-log::
- Do not list one-line descriptions from the actual commits being
- merged.
-
---summary::
---no-summary::
- Synonyms to --log and --no-log; these are deprecated and will be
- removed in the future.
+ one-line descriptions from at most <n> actual commits that are
+ being merged.
-m <message>::
--message <message>::
@@ -53,7 +44,10 @@ CONFIGURATION
merge.log::
Whether to include summaries of merged commits in newly
- merge commit messages. False by default.
+ created merge commit messages. Optionally, an integer can be
+ used to specify how many merged commits to summarize (at
+ maxmium) in the merge message. Specifying "true" is equivalent
+ to specifying 20. Defaults to false.
merge.summary::
Synonym to `merge.log`; this is deprecated and will be removed in
diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt
index b72f533..f63f7cb 100644
--- a/Documentation/merge-config.txt
+++ b/Documentation/merge-config.txt
@@ -7,8 +7,12 @@ merge.conflictstyle::
marker and the original text before the `=======` marker.
merge.log::
- Whether to include summaries of merged commits in newly created
- merge commit messages. False by default.
+ Whether to include summaries of merged commits in newly
+ created merge commit messages. Optionally, an integer can be
+ used to specify how many merged commits to summarize (at
+ maxmium) in the merge message. Specifying "true" is equivalent
+ to specifying 20. Defaults to false. See also
+ linkgit:git-fmt-merge-msg[1].
merge.renameLimit::
The number of files to consider when performing rename detection
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] fmt-merge-msg: Remove deprecated --summary option
2010-08-20 12:23 [PATCH 0/4] fmt-merge-msg improvements Ramkumar Ramachandra
` (2 preceding siblings ...)
2010-08-20 12:24 ` [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra
@ 2010-08-20 12:24 ` Ramkumar Ramachandra
3 siblings, 0 replies; 10+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 12:24 UTC (permalink / raw)
To: Git Mailing List; +Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko
Remove the deprecated --summary option that served as a syonym to the
--log option.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
Documentation/git-fmt-merge-msg.txt | 4 ----
builtin/fmt-merge-msg.c | 13 ++-----------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt
index a930eeb..e3be3a3 100644
--- a/Documentation/git-fmt-merge-msg.txt
+++ b/Documentation/git-fmt-merge-msg.txt
@@ -49,10 +49,6 @@ merge.log::
maxmium) in the merge message. Specifying "true" is equivalent
to specifying 20. Defaults to false.
-merge.summary::
- Synonym to `merge.log`; this is deprecated and will be removed in
- the future.
-
SEE ALSO
--------
linkgit:git-merge[1]
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 67f24f8..966647a 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -15,18 +15,12 @@ static int log_limit = 0;
static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
{
- static int found_merge_log = 0;
int is_bool;
if (!strcmp("merge.log", key)) {
- found_merge_log = 1;
log_limit = git_config_bool_or_int(key, value, &is_bool);
+ if (is_bool && log_limit)
+ log_limit = 20;
}
- if (!found_merge_log && !strcmp("merge.summary", key))
- log_limit = git_config_bool_or_int(key, value, &is_bool);
-
- if (is_bool && log_limit)
- log_limit = 20;
-
return 0;
}
@@ -328,9 +322,6 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
struct option options[] = {
OPT_INTEGER(0, "log", &log_limit,
"populate log with <n> entries from shortlog"),
- { OPTION_BOOLEAN, 0, "summary", &log_limit, 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"),
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation
2010-08-20 12:24 ` [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra
@ 2010-08-20 12:39 ` Ramkumar Ramachandra
2010-08-20 12:44 ` Johannes Sixt
0 siblings, 1 reply; 10+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 12:39 UTC (permalink / raw)
To: Git Mailing List; +Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko
Hi,
Minor mistake: This patch removes the --summary option from the
documentation before removing it from the code. Swapping this patch
with part 4 will fix the issue.
-- Ram
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation
2010-08-20 12:39 ` Ramkumar Ramachandra
@ 2010-08-20 12:44 ` Johannes Sixt
2010-08-20 13:12 ` Ramkumar Ramachandra
0 siblings, 1 reply; 10+ messages in thread
From: Johannes Sixt @ 2010-08-20 12:44 UTC (permalink / raw)
To: Ramkumar Ramachandra
Cc: Git Mailing List, Jonathan Nieder, Yaroslav Halchenko
Am 8/20/2010 14:39, schrieb Ramkumar Ramachandra:
> Minor mistake: This patch removes the --summary option from the
> documentation before removing it from the code.
Not only that: It also removes --no-log, and makes the argument to --log
mandatory, doesn't it?
-- Hannes
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation
2010-08-20 12:44 ` Johannes Sixt
@ 2010-08-20 13:12 ` Ramkumar Ramachandra
2010-08-20 14:10 ` Jonathan Nieder
0 siblings, 1 reply; 10+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 13:12 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Git Mailing List, Jonathan Nieder, Yaroslav Halchenko
Hi,
Johannes Sixt writes:
> Am 8/20/2010 14:39, schrieb Ramkumar Ramachandra:
> > Minor mistake: This patch removes the --summary option from the
> > documentation before removing it from the code.
>
> Not only that: It also removes --no-log, and makes the argument to --log
> mandatory, doesn't it?
Yeah, that was sort of intended- Is this undesired?
I noticed that the command-line parsing framework has only OPT_BOOLEAN
and OPT_INTEGER, but no OPT_BOOLEAN_OR_INTEGER.
-- Ram
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation
2010-08-20 13:12 ` Ramkumar Ramachandra
@ 2010-08-20 14:10 ` Jonathan Nieder
2010-08-20 15:00 ` Ramkumar Ramachandra
0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Nieder @ 2010-08-20 14:10 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: Johannes Sixt, Git Mailing List, Yaroslav Halchenko
Hi Ram,
Ramkumar Ramachandra wrote:
> I noticed that the command-line parsing framework has only OPT_BOOLEAN
> and OPT_INTEGER, but no OPT_BOOLEAN_OR_INTEGER.
--no-<foo> works already with OPT_INTEGER. But for --<foo>, one
needs the
{ OPTION_INTEGER, short, long, &var, "n", description,
PARSE_OPT_OPTARG, NULL, 20 },
form.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation
2010-08-20 14:10 ` Jonathan Nieder
@ 2010-08-20 15:00 ` Ramkumar Ramachandra
0 siblings, 0 replies; 10+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-20 15:00 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Johannes Sixt, Git Mailing List, Yaroslav Halchenko
Hi Jonathan,
Jonathan Nieder writes:
> Ramkumar Ramachandra wrote:
>
> > I noticed that the command-line parsing framework has only OPT_BOOLEAN
> > and OPT_INTEGER, but no OPT_BOOLEAN_OR_INTEGER.
>
> --no-<foo> works already with OPT_INTEGER. But for --<foo>, one
> needs the
>
> { OPTION_INTEGER, short, long, &var, "n", description,
> PARSE_OPT_OPTARG, NULL, 20 },
>
> form.
Thanks, I'll re-roll with this fix.
-- Ram
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-08-20 15:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-20 12:23 [PATCH 0/4] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-20 12:23 ` [PATCH 1/4] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
2010-08-20 12:23 ` [PATCH 2/4] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
2010-08-20 12:24 ` [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra
2010-08-20 12:39 ` Ramkumar Ramachandra
2010-08-20 12:44 ` Johannes Sixt
2010-08-20 13:12 ` Ramkumar Ramachandra
2010-08-20 14:10 ` Jonathan Nieder
2010-08-20 15:00 ` Ramkumar Ramachandra
2010-08-20 12:24 ` [PATCH 4/4] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.