From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Johannes Sixt <j.sixt@viscovery.net>,
Jonathan Nieder <jrnieder@gmail.com>,
Yaroslav Halchenko <debian@onerussian.com>
Subject: [PATCH v2 1/4] fmt-merge-msg: Make the number of log entries in commit message configurable
Date: Fri, 20 Aug 2010 22:24:49 +0530 [thread overview]
Message-ID: <1282323292-11412-2-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1282323292-11412-1-git-send-email-artagnon@gmail.com>
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>
Thanks-to: Johannes Sixt <j.sixt@viscovery.net>
Thanks-to: 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..e967a05 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 = 0;
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.408.g7357
next prev parent reply other threads:[~2010-08-20 16:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-20 16:54 [PATCH v2 0/4] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-20 16:54 ` Ramkumar Ramachandra [this message]
2010-08-20 16:54 ` [PATCH v2 2/4] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
2010-08-20 16:54 ` [PATCH v2 3/4] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
2010-08-20 16:54 ` [PATCH v2 4/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra
2010-08-20 17:36 ` Jakub Narebski
2010-08-20 18:06 ` Ramkumar Ramachandra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282323292-11412-2-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=debian@onerussian.com \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).