* [PATCH v4 0/5] fmt-merge-msg improvements
@ 2010-08-21 9:58 Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-21 9:58 UTC (permalink / raw)
To: Git Mailing List
Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
Junio C Hamano
This version uses PARSE_OPT_OPTARG instead of PARSE_OPT_NOOPT. Also,
there are a few minor fixes from Jonathan's reviews.
Junio: If the --summary shouldn't be removed before 1.8.0, feel free
to drop PATCH 4/5 for now. I've made it independent of the other
patches in this round.
Jonathan Nieder (1):
parse-options: clarify PARSE_OPT_NOARG description
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 | 24 +++++++------------
Documentation/merge-config.txt | 8 ++++-
builtin/fmt-merge-msg.c | 44 ++++++++++++++++------------------
parse-options.h | 2 +-
4 files changed, 37 insertions(+), 41 deletions(-)
--
1.7.2.2.409.gdbb11.dirty
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable
2010-08-21 9:58 [PATCH v4 0/5] fmt-merge-msg improvements Ramkumar Ramachandra
@ 2010-08-21 9:58 ` Ramkumar Ramachandra
2010-08-22 3:33 ` Jonathan Nieder
2010-08-21 9:58 ` [PATCH v4 2/5] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-21 9:58 UTC (permalink / raw)
To: Git Mailing List
Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
Junio C Hamano
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 <at> onerussian.com>
Thanks-to: Johannes Sixt <j.sixt <at> viscovery.net>
Thanks-to: Jonathan Nieder <jrnieder <at> 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.2.2.409.gdbb11.dirty
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 2/5] fmt-merge-msg: Update command line options to sync with config options
2010-08-21 9:58 [PATCH v4 0/5] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
@ 2010-08-21 9:58 ` Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 3/5] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-21 9:58 UTC (permalink / raw)
To: Git Mailing List
Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
Junio C Hamano
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 <at> viscovery.net>
Cc: Jonathan Nieder <jrnieder <at> gmail.com>
---
builtin/fmt-merge-msg.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 66b1cbd..cad9ed4 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -7,11 +7,10 @@
#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 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,10 +326,12 @@ 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,
+ { OPTION_INTEGER, 0, "log", &log_limit, "n",
+ "populate log with <n> entries from shortlog",
+ PARSE_OPT_OPTARG, NULL, 20 },
+ { OPTION_INTEGER, 0, "summary", &log_limit, "n",
"alias for --log (deprecated)",
- PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
+ PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },
OPT_STRING('m', "message", &message, "text",
"use <text> as start of message"),
OPT_FILENAME('F', "file", &inpath, "file to read from"),
@@ -347,7 +347,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 +366,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.2.2.409.gdbb11.dirty
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 3/5] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation
2010-08-21 9:58 [PATCH v4 0/5] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 2/5] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
@ 2010-08-21 9:58 ` Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 4/5] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 5/5] parse-options: clarify PARSE_OPT_NOARG description Ramkumar Ramachandra
4 siblings, 0 replies; 9+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-21 9:58 UTC (permalink / raw)
To: Git Mailing List
Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
Junio C Hamano
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 <at> viscovery.net>
Cc: Jonathan Nieder <jrnieder <at> gmail.com>
---
Documentation/git-fmt-merge-msg.txt | 15 +++++++++------
Documentation/merge-config.txt | 8 ++++++--
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt
index 302f56b..9499322 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>] [--[no-]log[=<n>]] < $GIT_DIR/FETCH_HEAD
+'git fmt-merge-msg' [-m <message>] [--[no-]log[=<n>]] -F <file>
DESCRIPTION
-----------
@@ -24,10 +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.
+ one-line descriptions from at most <n> actual commits that are
+ being merged. If omitted, <n> defaults to 20.
--no-log::
Do not list one-line descriptions from the actual commits being
@@ -53,7 +53,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.2.2.409.gdbb11.dirty
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 4/5] fmt-merge-msg: Remove deprecated --summary option
2010-08-21 9:58 [PATCH v4 0/5] fmt-merge-msg improvements Ramkumar Ramachandra
` (2 preceding siblings ...)
2010-08-21 9:58 ` [PATCH v4 3/5] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra
@ 2010-08-21 9:58 ` Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 5/5] parse-options: clarify PARSE_OPT_NOARG description Ramkumar Ramachandra
4 siblings, 0 replies; 9+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-21 9:58 UTC (permalink / raw)
To: Git Mailing List
Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
Junio C Hamano
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 | 9 ---------
builtin/fmt-merge-msg.c | 13 ++-----------
2 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt
index 9499322..5a5c318 100644
--- a/Documentation/git-fmt-merge-msg.txt
+++ b/Documentation/git-fmt-merge-msg.txt
@@ -33,11 +33,6 @@ OPTIONS
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.
-
-m <message>::
--message <message>::
Use <message> instead of the branch names for the first line
@@ -58,10 +53,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 cad9ed4..1e969f2 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;
}
@@ -329,9 +323,6 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
{ OPTION_INTEGER, 0, "log", &log_limit, "n",
"populate log with <n> entries from shortlog",
PARSE_OPT_OPTARG, NULL, 20 },
- { OPTION_INTEGER, 0, "summary", &log_limit, "n",
- "alias for --log (deprecated)",
- PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },
OPT_STRING('m', "message", &message, "text",
"use <text> as start of message"),
OPT_FILENAME('F', "file", &inpath, "file to read from"),
--
1.7.2.2.409.gdbb11.dirty
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 5/5] parse-options: clarify PARSE_OPT_NOARG description
2010-08-21 9:58 [PATCH v4 0/5] fmt-merge-msg improvements Ramkumar Ramachandra
` (3 preceding siblings ...)
2010-08-21 9:58 ` [PATCH v4 4/5] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
@ 2010-08-21 9:58 ` Ramkumar Ramachandra
4 siblings, 0 replies; 9+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-21 9:58 UTC (permalink / raw)
To: Git Mailing List
Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
Junio C Hamano
From: Jonathan Nieder <jrnieder@gmail.com>
Here "takes no argument" means "does not take an argument". The
latter phrasing might make it clearer that PARSE_OPT_NOARG does not
make an option with an argument that can optionally be left off.
Noticed-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
parse-options.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/parse-options.h b/parse-options.h
index d3b1932..f5ee3a0 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -69,7 +69,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
* `flags`::
* mask of parse_opt_option_flags.
* PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs)
- * PARSE_OPT_NOARG: says that this option takes no argument
+ * PARSE_OPT_NOARG: says that this option does not take an argument
* PARSE_OPT_NONEG: says that this option cannot be negated
* PARSE_OPT_HIDDEN: this option is skipped in the default usage, and
* shown only in the full usage.
--
1.7.2.2.409.gdbb11.dirty
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable
2010-08-21 9:58 ` [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
@ 2010-08-22 3:33 ` Jonathan Nieder
2010-08-22 5:05 ` Junio C Hamano
2010-08-22 6:53 ` Ramkumar Ramachandra
0 siblings, 2 replies; 9+ messages in thread
From: Jonathan Nieder @ 2010-08-22 3:33 UTC (permalink / raw)
To: Ramkumar Ramachandra
Cc: Git Mailing List, Johannes Sixt, Yaroslav Halchenko,
Junio C Hamano
Hi again,
Thanks for working on this.
Ramkumar Ramachandra wrote:
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> Reported-by: Yaroslav Halchenko <debian <at> onerussian.com>
Looks like some of the @ signs have been corrupted somehow.
> +++ 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;
I still don't see why the merge_summary is needed...
> static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
[...]
> + merge_summary = log_limit ? 1 : 0;
... since shouldn't it always be equal to log_limit ? 1 : 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,
This adds to my confusion. Suppose the statics have values
merge_summary = 0;
log_limit = 11;
and I try
fmt_merge_msg(5, &in, &out);
What will happen?
Currently (before this patch) the rules are as follows:
- the merge_summary parameter to fmt_merge_msg
alone decides whether a shortlog (of at most 20 items
per parent) is printed.
To outside users (think "git merge"), the static
merge_summary var is simply irrelevant.
- the static merge_summary variable is used internally by "git
fmt-merge-msg" command-line and configuration parsing (with
command line winning in ties).
and builtin/merge.c has its own separate code for parsing merge.*
configuration.
FWIW if I were writing it, I would make changes in something like this
order:
- Change fmt_merge_msg API to
int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
int shortlog_len);
where shortlog_len is 0 for no shortlog, 20 for a shortlog
with 20 items. Update all callers (the changed function
signature makes it easy to find them).
- Update merge --log and fmt-merge-msg --log options to take
an optional "size of shortlog" argument.
- update [merge] log configuration to accept an integer
"size of shortlog" value.
The first step might look like this.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
builtin.h | 4 ++--
builtin/fmt-merge-msg.c | 18 +++++++++---------
builtin/merge.c | 3 ++-
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/builtin.h b/builtin.h
index ed6ee26..a7352df 100644
--- a/builtin.h
+++ b/builtin.h
@@ -14,8 +14,8 @@ extern const char git_more_info_string[];
extern void list_common_cmds_help(void);
extern const char *help_unknown_cmd(const char *cmd);
extern void prune_packed_objects(int);
-extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
- struct strbuf *out);
+extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
+ int shortlog_len);
extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out);
extern int commit_notes(struct notes_tree *t, const char *msg);
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index a76cd4e..83692c1 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -255,9 +255,9 @@ 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,
- struct strbuf *in, struct strbuf *out) {
- int limit = 20, i = 0, pos = 0;
+static int do_fmt_merge_msg(int merge_title,
+ struct strbuf *in, struct strbuf *out, int shortlog_len) {
+ int i = 0, pos = 0;
unsigned char head_sha1[20];
const char *current_branch;
@@ -288,7 +288,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 (shortlog_len) {
struct commit *head;
struct rev_info rev;
@@ -303,17 +303,17 @@ 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, shortlog_len, out);
}
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(struct strbuf *in, struct strbuf *out, int shortlog_len) {
+ return do_fmt_merge_msg(1, in, out, shortlog_len);
}
int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {
- return do_fmt_merge_msg(0, 1, in, out);
+ return do_fmt_merge_msg(0, in, out, 20);
}
int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
@@ -346,7 +346,7 @@ 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);
+ ret = fmt_merge_msg(&input, &output, merge_summary ? 20 : 0);
if (ret)
return ret;
write_in_full(STDOUT_FILENO, output.buf, output.len);
diff --git a/builtin/merge.c b/builtin/merge.c
index 37ce4f5..8b0b2e2 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1001,7 +1001,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
if (have_message && option_log)
fmt_merge_msg_shortlog(&merge_names, &merge_msg);
else if (!have_message)
- fmt_merge_msg(option_log, &merge_names, &merge_msg);
+ fmt_merge_msg(&merge_names, &merge_msg,
+ option_log ? 20 : 0);
if (!(have_message && !option_log) && merge_msg.len)
--
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable
2010-08-22 3:33 ` Jonathan Nieder
@ 2010-08-22 5:05 ` Junio C Hamano
2010-08-22 6:53 ` Ramkumar Ramachandra
1 sibling, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2010-08-22 5:05 UTC (permalink / raw)
To: Jonathan Nieder
Cc: Ramkumar Ramachandra, Git Mailing List, Johannes Sixt,
Yaroslav Halchenko, Junio C Hamano
Jonathan Nieder <jrnieder@gmail.com> writes:
> FWIW if I were writing it, I would make changes in something like this
> order:
>
> - Change fmt_merge_msg API to
>
> int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
> int shortlog_len);
>
> where shortlog_len is 0 for no shortlog, 20 for a shortlog
> with 20 items. Update all callers (the changed function
> signature makes it easy to find them).
>
> - Update merge --log and fmt-merge-msg --log options to take
> an optional "size of shortlog" argument.
>
> - update [merge] log configuration to accept an integer
> "size of shortlog" value.
>
> The first step might look like this.
Thanks; it is very pleasing to see a more experienced contributor
mentoring another with a good example to show _how_ the design of a new
feature should be done.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable
2010-08-22 3:33 ` Jonathan Nieder
2010-08-22 5:05 ` Junio C Hamano
@ 2010-08-22 6:53 ` Ramkumar Ramachandra
1 sibling, 0 replies; 9+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-22 6:53 UTC (permalink / raw)
To: Jonathan Nieder
Cc: Git Mailing List, Johannes Sixt, Yaroslav Halchenko,
Junio C Hamano
Hi Jonathan,
Jonathan Nieder writes:
> Hi again,
>
> Thanks for working on this.
>
> Ramkumar Ramachandra wrote:
>
> > Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> > Reported-by: Yaroslav Halchenko <debian <at> onerussian.com>
>
> Looks like some of the @ signs have been corrupted somehow.
My stupidity- I copied the additional lines off the GMane interface.
[...]
> FWIW if I were writing it, I would make changes in something like this
> order:
>
> - Change fmt_merge_msg API to
>
> int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
> int shortlog_len);
>
> where shortlog_len is 0 for no shortlog, 20 for a shortlog
> with 20 items. Update all callers (the changed function
> signature makes it easy to find them).
>
> - Update merge --log and fmt-merge-msg --log options to take
> an optional "size of shortlog" argument.
>
> - update [merge] log configuration to accept an integer
> "size of shortlog" value.
>
> The first step might look like this.
[...]
Thanks for being so patient! It looks like there's no end to my
mistakes :p
I'll rewrite this and try to follow the guidelines you've outlined in
future- hopefully, I'll become more experienced someday :)
-- Ram
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-08-22 7:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-21 9:58 [PATCH v4 0/5] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
2010-08-22 3:33 ` Jonathan Nieder
2010-08-22 5:05 ` Junio C Hamano
2010-08-22 6:53 ` Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 2/5] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 3/5] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 4/5] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
2010-08-21 9:58 ` [PATCH v4 5/5] parse-options: clarify PARSE_OPT_NOARG description Ramkumar Ramachandra
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).