git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Two tests for rr/fmt-merge-msg
@ 2010-08-27 14:14 Ramkumar Ramachandra
  2010-08-27 14:14 ` [PATCH 1/2] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length Ramkumar Ramachandra
  2010-08-27 14:14 ` [PATCH 2/2] t6200-fmt-merge-msg: Exercise '--log' " Ramkumar Ramachandra
  0 siblings, 2 replies; 7+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-27 14:14 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jonathan Nieder

These tests exercise the feature in rr/fmt-merge-msg.

Ramkumar Ramachandra (2):
  t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog
    length
  t6200-fmt-merge-msg: Exercise '--log' to configure shortlog length

 t/t6200-fmt-merge-msg.sh |  111 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+), 0 deletions(-)

-- 
1.7.2.2.409.gdbb11.dirty

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length
  2010-08-27 14:14 [PATCH 0/2] Two tests for rr/fmt-merge-msg Ramkumar Ramachandra
@ 2010-08-27 14:14 ` Ramkumar Ramachandra
  2010-08-28  2:00   ` Jonathan Nieder
  2010-08-27 14:14 ` [PATCH 2/2] t6200-fmt-merge-msg: Exercise '--log' " Ramkumar Ramachandra
  1 sibling, 1 reply; 7+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-27 14:14 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jonathan Nieder

Add a test to exercise the 'merge.log' configuration option of 'git
fmt-merge-msg'. It controls the number of shortlog entries to display
in merge commit messages.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 t/t6200-fmt-merge-msg.sh |   55 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 71f6cad..750568e 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -129,6 +129,61 @@ test_expect_success '[merge] summary/log configuration' '
 	test_cmp expected actual2
 '
 
+test_expect_success 'configurable shortlog length: merge.log' '
+	cat >expected_a <<-EOF &&
+	Merge branch ${apos}left${apos}
+
+	* left: (5 commits)
+	  Left #5
+	  Left #4
+	  Left #3
+	  ...
+	EOF
+
+	git config merge.log 3 &&
+	test_might_fail git config --unset-all merge.summary &&
+
+	git checkout master &&
+	test_tick &&
+	git fetch . left &&
+
+	git fmt-merge-msg <.git/FETCH_HEAD >actual1 &&
+
+	test_might_fail git config --unset-all merge.log &&
+	git config merge.summary 3 &&
+
+	git checkout master &&
+	test_tick &&
+	git fetch . left &&
+
+	git fmt-merge-msg <.git/FETCH_HEAD >actual2 &&
+
+	echo "Merge branch ${apos}left${apos}" >expected_b &&
+
+	git config merge.log 0 &&
+	test_might_fail git config --unset-all merge.summary &&
+
+	git checkout master &&
+	test_tick &&
+	git fetch . left &&
+
+	git fmt-merge-msg <.git/FETCH_HEAD >actual3 &&
+
+	test_might_fail git config --unset-all merge.log &&
+	test_might_fail git config --unset-all merge.summary &&
+
+	git checkout master &&
+	test_tick &&
+	git fetch . left &&
+
+	git fmt-merge-msg <.git/FETCH_HEAD >actual4 &&
+
+	test_cmp expected_a actual1 &&
+	test_cmp expected_a actual2 &&
+	test_cmp expected_b actual3 &&
+	test_cmp expected_b actual4
+'
+
 test_expect_success 'fmt-merge-msg -m' '
 	echo "Sync with left" >expected &&
 	cat >expected.log <<-EOF &&
-- 
1.7.2.2.409.gdbb11.dirty

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] t6200-fmt-merge-msg: Exercise '--log' to configure shortlog length
  2010-08-27 14:14 [PATCH 0/2] Two tests for rr/fmt-merge-msg Ramkumar Ramachandra
  2010-08-27 14:14 ` [PATCH 1/2] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length Ramkumar Ramachandra
@ 2010-08-27 14:14 ` Ramkumar Ramachandra
  1 sibling, 0 replies; 7+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-27 14:14 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jonathan Nieder

Add a test to exercise the '--log' command-line option of 'git
fmt-merge-msg'. It controls the number of shortlog entries to display
in merge commit messages.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 t/t6200-fmt-merge-msg.sh |   56 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 750568e..b308c3b 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -184,6 +184,62 @@ test_expect_success 'configurable shortlog length: merge.log' '
 	test_cmp expected_b actual4
 '
 
+test_expect_success 'configurable shortlog length: --log' '
+	cat >expected1 <<-EOF &&
+	Merge branch ${apos}left${apos}
+
+	* left: (5 commits)
+	  Left #5
+	  Left #4
+	  Left #3
+	  ...
+	EOF
+
+	test_might_fail git config --unset-all merge.log &&
+	test_might_fail git config --unset-all merge.summary &&
+
+	git checkout master &&
+	test_tick &&
+	git fetch . left &&
+
+	git fmt-merge-msg --log=3 <.git/FETCH_HEAD >actual1 &&
+
+	cat >expected_b <<-EOF &&
+	Merge branch ${apos}left${apos}
+
+	* left:
+	  Left #5
+	  Left #4
+	  Left #3
+	  Common #2
+	  Common #1
+	EOF
+
+	test_might_fail git config --unset-all merge.log &&
+	test_might_fail git config --unset-all merge.summary &&
+
+	git checkout master &&
+	test_tick &&
+	git fetch . left &&
+
+	git fmt-merge-msg --log <.git/FETCH_HEAD >actual2 &&
+
+	echo "Merge branch ${apos}left${apos}" >expected_c &&
+
+	test_might_fail git config --unset-all merge.log &&
+	test_might_fail git config --unset-all merge.summary &&
+
+	git checkout master &&
+	test_tick &&
+	git fetch . left &&
+
+	git fmt-merge-msg --no-log <.git/FETCH_HEAD >actual3 &&
+
+	test_cmp expected_a actual1 &&
+	test_cmp expected_b actual2 &&
+	test_cmp expected_c actual3
+'
+
 test_expect_success 'fmt-merge-msg -m' '
 	echo "Sync with left" >expected &&
 	cat >expected.log <<-EOF &&
-- 
1.7.2.2.409.gdbb11.dirty

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length
  2010-08-27 14:14 ` [PATCH 1/2] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length Ramkumar Ramachandra
@ 2010-08-28  2:00   ` Jonathan Nieder
  2010-08-28  2:05     ` Jonathan Nieder
  2010-08-28 10:35     ` Ramkumar Ramachandra
  0 siblings, 2 replies; 7+ messages in thread
From: Jonathan Nieder @ 2010-08-28  2:00 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git Mailing List, Junio C Hamano

Hi,

Ramkumar Ramachandra wrote:

> Add a test to exercise the 'merge.log' configuration option

Thanks!

> +test_expect_success 'configurable shortlog length: merge.log' '

I suspect this test would be easier to understand if split up (yes, I
know I'm guilty of the same in other tests from this file).

Maybe something like this?

	test_expect_success 'setup: clear [merge] configuration' '
		test_might_fail git config --unset-all merge.log &&
		test_might_fail git config --unset-all merge.summary
	'

	test_expect_success 'set up FETCH_HEAD' '
		git checkout master &&
		git fetch . left
	'

	test_expect_success 'merge.log=3 limits shortlog length' '
		test_might_fail git config --unset merge.log &&
		test_might_fail git config --unset merge.summary &&

		cat >expected <<-\EOF &&
		  Left #3
		  ...
		EOF
		git -c merge.log=3 fmt-merge-msg <.git/FETCH_HEAD >msg &&

		tail -n 2 msg >actual &&
		test_cmp expected actual
	'

	test_expect_success 'shortlog length defaults to 20' '
		[...]
	'

	test_expect_success 'merge.log=5 does not limit shortlog length' '
		[...]
	'

	test_expect_success 'merge.log=6 does not limit shortlog length' '
		[...]
	'

	test_expect_success 'merge.log=0 disables shortlog' '
		[...]
	'

	test_expect_success 'merge.log=-1 does something sane' '
		[...]
	'

I can clean up the earlier tests afterwards. :)
Jonathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length
  2010-08-28  2:00   ` Jonathan Nieder
@ 2010-08-28  2:05     ` Jonathan Nieder
  2010-08-28 10:35     ` Ramkumar Ramachandra
  1 sibling, 0 replies; 7+ messages in thread
From: Jonathan Nieder @ 2010-08-28  2:05 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git Mailing List, Junio C Hamano

Jonathan Nieder wrote:

> Maybe something like this?
> 
> 	test_expect_success 'setup: clear [merge] configuration' '
> 		test_might_fail git config --unset-all merge.log &&
> 		test_might_fail git config --unset-all merge.summary
> 	'
> 
> 	test_expect_success 'set up FETCH_HEAD' '
> 		git checkout master &&
> 		git fetch . left
> 	'
> 
> 	test_expect_success 'merge.log=3 limits shortlog length' '
> 		test_might_fail git config --unset merge.log &&
> 		test_might_fail git config --unset merge.summary &&

Erm, these two lines wouldn't be necessary given the earlier setup,
of course.
> 
> 		cat >expected <<-\EOF &&
> 		  Left #3
> 		  ...
> 		EOF
> 		git -c merge.log=3 fmt-merge-msg <.git/FETCH_HEAD >msg &&
> 
> 		tail -n 2 msg >actual &&
> 		test_cmp expected actual
> 	'

Sorry for the noise.

*goes off to sleep*

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length
  2010-08-28  2:00   ` Jonathan Nieder
  2010-08-28  2:05     ` Jonathan Nieder
@ 2010-08-28 10:35     ` Ramkumar Ramachandra
  2010-08-28 17:09       ` Jonathan Nieder
  1 sibling, 1 reply; 7+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-28 10:35 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Git Mailing List, Junio C Hamano

Hi Jonathan,

Jonathan Nieder writes:
> I suspect this test would be easier to understand if split up (yes, I
> know I'm guilty of the same in other tests from this file).

I sort of tried to follow what was done in the rest of the file. If
this style is desired instead, I'll post an alternative series
instead.

> 	test_expect_success 'setup: clear [merge] configuration' '
> 		test_might_fail git config --unset-all merge.log &&
> 		test_might_fail git config --unset-all merge.summary
> 	'
> 
> 	test_expect_success 'set up FETCH_HEAD' '
> 		git checkout master &&
> 		git fetch . left
> 	'

Okay.

> 	test_expect_success 'merge.log=3 limits shortlog length' '
> 		test_might_fail git config --unset merge.log &&
> 		test_might_fail git config --unset merge.summary &&

Redundant, as you pointed out in another email.

> 		cat >expected <<-\EOF &&
> 		  Left #3
> 		  ...
> 		EOF
> 		git -c merge.log=3 fmt-merge-msg <.git/FETCH_HEAD >msg &&
> 
> 		tail -n 2 msg >actual &&
> 		test_cmp expected actual
> 	'

Ok. I don't like the `tail` thing. Why are you doing it instead of
comparing full outputs like the tests in the rest of the file?

> 	test_expect_success 'shortlog length defaults to 20' '
> 		[...]
> 	'

Actually, we can't test this unless we actually create a branch with
20 commits and merge it. I've dropped this- you might like to add it
during the cleanup.

> 	test_expect_success 'merge.log=5 does not limit shortlog length' '
> 		[...]
> 	'

Okay.

> 	test_expect_success 'merge.log=6 does not limit shortlog length' '
> 		[...]
> 	'

I thought this was a bit of an overkill, so I removed it.

> 	test_expect_success 'merge.log=0 disables shortlog' '
> 		[...]
> 	'

Okay.

> 	test_expect_success 'merge.log=-1 does something sane' '
> 		[...]
> 	'

Thanks! I found a bug and fixed it (patch will come in a moment).

> I can clean up the earlier tests afterwards. :)

Okay, sounds good.

-- Ram

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length
  2010-08-28 10:35     ` Ramkumar Ramachandra
@ 2010-08-28 17:09       ` Jonathan Nieder
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Nieder @ 2010-08-28 17:09 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git Mailing List, Junio C Hamano

Ramkumar Ramachandra wrote:
> Jonathan Nieder writes:

>> 		cat >expected <<-\EOF &&
>> 		  Left #3
>> 		  ...
>> 		EOF
>> 		git -c merge.log=3 fmt-merge-msg <.git/FETCH_HEAD >msg &&
>> 
>> 		tail -n 2 msg >actual &&
>> 		test_cmp expected actual
>> 	'
>
> Ok. I don't like the `tail` thing. Why are you doing it instead of
> comparing full outputs like the tests in the rest of the file?

No good reason. :)

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-08-28 17:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-27 14:14 [PATCH 0/2] Two tests for rr/fmt-merge-msg Ramkumar Ramachandra
2010-08-27 14:14 ` [PATCH 1/2] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length Ramkumar Ramachandra
2010-08-28  2:00   ` Jonathan Nieder
2010-08-28  2:05     ` Jonathan Nieder
2010-08-28 10:35     ` Ramkumar Ramachandra
2010-08-28 17:09       ` Jonathan Nieder
2010-08-27 14:14 ` [PATCH 2/2] t6200-fmt-merge-msg: Exercise '--log' " Ramkumar Ramachandra

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