All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Johannes Sixt <j.sixt@viscovery.net>,
	Yaroslav Halchenko <debian@onerussian.com>,
	Jakub Narebski <jnareb@gmail.com>
Subject: Re: [PATCH v3 2/5] fmt-merge-msg: Make the number of log entries in commit message configurable
Date: Fri, 20 Aug 2010 22:54:03 -0500	[thread overview]
Message-ID: <20100821035403.GA2474@burratino> (raw)
In-Reply-To: <1282331702-5115-3-git-send-email-artagnon@gmail.com>

Ramkumar Ramachandra wrote:

> +++ 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;

Hmm, this seems to be trying to have it both ways.  It would be simpler to
either:

	static int merge_summary;
	static int log_limit = 20;

providing independent internal "enabled" and "limit" knobs, so one could use,
say,

	[merge]
		log = 2
		log = false
		log = true

with the result being be a log_limit of 2, or

	static int log_limit;

where 0 means disabled, so in that example the result would be a log_limit
of 20.

> @@ -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)

A part of me wishes we would still pass the limit around (for no good
reason), but you are probably right that it is easier to work with the
global.

> @@ -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,

What happened to the merge_summary argument?

  reply	other threads:[~2010-08-21  3:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20 19:14 [PATCH v3 0/5] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-20 19:14 ` [PATCH v3 1/5] parse-options: Allow PARSE_OPT_NOARG in integer arguments Ramkumar Ramachandra
2010-08-20 19:49   ` Junio C Hamano
2010-08-20 20:01     ` Ramkumar Ramachandra
2010-08-21  3:39       ` Jonathan Nieder
2010-08-20 19:14 ` [PATCH v3 2/5] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
2010-08-21  3:54   ` Jonathan Nieder [this message]
2010-08-21  5:55     ` Ramkumar Ramachandra
2010-08-20 19:15 ` [PATCH v3 3/5] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
2010-08-21  4:02   ` Jonathan Nieder
2010-08-21  5:51     ` Ramkumar Ramachandra
2010-08-20 19:15 ` [PATCH v3 4/5] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
2010-08-21  4:04   ` Jonathan Nieder
2010-08-21  5:49     ` Ramkumar Ramachandra
2010-08-20 19:15 ` [PATCH v3 5/5] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100821035403.GA2474@burratino \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=debian@onerussian.com \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    --cc=jnareb@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.
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.