git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries
Date: Wed, 1 Sep 2010 00:43:37 +0530	[thread overview]
Message-ID: <20100831191324.GA27381@kytes> (raw)
In-Reply-To: <7vzkw2abpz.fsf@alter.siamese.dyndns.org>

Hi,

Junio C Hamano writes:
> Hmm, do we plan on that?  It sounds a little bit insane.  Erroring it out
> would be Ok.  How about doing this on top?

> @@ -350,7 +350,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
>  		return 0;
>  	}
>  	if (shortlog_len < 0)
> -		shortlog_len = DEFAULT_MERGE_LOG_LEN;
> +		die("Negative --log=%d???", shortlog_len);
>  
>  	if (inpath && strcmp(inpath, "-")) {
>  		in = fopen(inpath, "r");

It's a little asymmetric- the program won't error out when 'merge.log'
is set to -1. Then again, it's probably nicer to simply pretend that
we didn't see that invalid configuration.

Also, to avoid breaking the '--log=-1' test, either drop the test
altogether or use something like this:

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>

diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 395c23e..3bfdebc 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -236,7 +236,7 @@ test_expect_success '--log=0 disables shortlog' '
 	test_cmp expected actual
 '
 
-test_expect_success '--log=-1 does something sane' '
+test_expect_code 128 '--log=-1 errors out' '
 	cat >expected <<-EOF &&
 	Merge branch ${apos}left${apos}
 
@@ -248,8 +248,7 @@ test_expect_success '--log=-1 does something sane' '
 	  Common #1
 	EOF
 
-	git fmt-merge-msg --log=-1 <.git/FETCH_HEAD >actual &&
-	test_cmp expected actual
+	git fmt-merge-msg --log=-1 <.git/FETCH_HEAD >actual
 '
 
 test_expect_success 'fmt-merge-msg -m' '

  parent reply	other threads:[~2010-08-31 19:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-28 10:35 [PATCH 0/3] rr/fmt-merge-msg replacements Ramkumar Ramachandra
2010-08-28 10:35 ` [PATCH] fmt-merge-msg: Disallow '--log', 'merge.log' < 0 Ramkumar Ramachandra
2010-08-28 10:35 ` [PATCH 2/3] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length Ramkumar Ramachandra
2010-08-28 10:35 ` [PATCH 3/3] t6200-fmt-merge-msg: Exercise '--log' " Ramkumar Ramachandra
2010-08-31  3:53 ` [PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries Ramkumar Ramachandra
2010-08-31 14:32   ` Jonathan Nieder
2010-08-31 18:17     ` Junio C Hamano
2010-08-31 18:21       ` Jonathan Nieder
2010-08-31 19:13       ` Ramkumar Ramachandra [this message]
2010-08-31 19:53         ` Junio C Hamano
2010-09-01  4:22           ` Ramkumar Ramachandra
2010-08-31  3:53 ` [PATCH 2/2] merge: Make 'merge.log' an integer or boolean option 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=20100831191324.GA27381@kytes \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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.
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 NNTP newsgroup(s).