Re: [PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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' '
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]