# [PATCH] t7811 (grep-open): remove test_config() redefinition

6 messages from 2013-03-19 to 2013-03-20. Participants: Ramkumar Ramachandra, Junio C Hamano, Jonathan Nieder.
Thread: https://gitlist.dev/t/33228

## Ramkumar Ramachandra, 2013-03-19 10:43

Subject: [PATCH] t7811 (grep-open): remove test_config() redefinition
Message-ID: <1363689794-25974-1-git-send-email-artagnon@gmail.com>
URL: https://gitlist.dev/e/1363689794-25974-1-git-send-email-artagnon%40gmail.com

```
test_config() is already a well-defined function in
test-lib-functions.sh.  Don't duplicate it unnecessarily.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Found this while randomly grep'ping around.

 t/t7811-grep-open.sh | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/t/t7811-grep-open.sh b/t/t7811-grep-open.sh
index a895778..e1951a5 100755
--- a/t/t7811-grep-open.sh
+++ b/t/t7811-grep-open.sh
@@ -125,11 +125,6 @@ test_expect_success 'modified file' '
 	test_cmp empty out
 '
 
-test_config() {
-	git config "$1" "$2" &&
-	test_when_finished "git config --unset $1"
-}
-
 test_expect_success 'copes with color settings' '
 	rm -f actual &&
 	echo grep.h >expect &&
-- 
1.8.2

```

## Junio C Hamano, 2013-03-19 16:09

Subject: Re: [PATCH] t7811 (grep-open): remove test_config() redefinition
Message-ID: <7vk3p3jrrw.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vk3p3jrrw.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1363689794-25974-1-git-send-email-artagnon@gmail.com>

```
Ramkumar Ramachandra <artagnon@gmail.com> writes:

> test_config() is already a well-defined function in
> test-lib-functions.sh.  Don't duplicate it unnecessarily.

There are other instances of it in t7810 and t4018, with slightly
different styles.

t/t4018-diff-funcname.sh:test_config () {
t/t7810-grep.sh:test_config() {
t/t7811-grep-open.sh:test_config() {
t/test-lib-functions.sh:test_config () {

Incidentally, this is why a consistent coding style helps.  It
should be possible to catch all ofhtme with a single

	git grep 'test_config () {' t/

but the ones in t78xx wouldn't have been found.

> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  Found this while randomly grep'ping around.
>
>  t/t7811-grep-open.sh | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/t/t7811-grep-open.sh b/t/t7811-grep-open.sh
> index a895778..e1951a5 100755
> --- a/t/t7811-grep-open.sh
> +++ b/t/t7811-grep-open.sh
> @@ -125,11 +125,6 @@ test_expect_success 'modified file' '
>  	test_cmp empty out
>  '
>  
> -test_config() {
> -	git config "$1" "$2" &&
> -	test_when_finished "git config --unset $1"
> -}
> -
>  test_expect_success 'copes with color settings' '
>  	rm -f actual &&
>  	echo grep.h >expect &&

```

## Ramkumar Ramachandra, 2013-03-20 08:21

Subject: [PATCH] t: don't redefine test_config() in various places
Message-ID: <1363767703-12936-1-git-send-email-artagnon@gmail.com>
URL: https://gitlist.dev/e/1363767703-12936-1-git-send-email-artagnon%40gmail.com
In-Reply-To: <7vk3p3jrrw.fsf@alter.siamese.dyndns.org>

```
test_config() is already a well-defined function in
test-lib-functions.sh.  Don't duplicate it unnecessarily in:

  t4018-diff-funcname.sh
  t7810-grep.sh
  t7811-grep-open.sh

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

 t/t4018-diff-funcname.sh | 5 -----
 t/t7810-grep.sh          | 5 -----
 t/t7811-grep-open.sh     | 5 -----
 3 files changed, 15 deletions(-)

diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index 082d3e8..38a092a 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -93,11 +93,6 @@ sed -e '
 	s/song;/song();/
 ' <Beer.perl >Beer-correct.perl
 
-test_config () {
-	git config "$1" "$2" &&
-	test_when_finished "git config --unset $1"
-}
-
 test_expect_funcname () {
 	lang=${2-java}
 	test_expect_code 1 git diff --no-index -U1 \
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index f698001..500eb50 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -1084,11 +1084,6 @@ test_expect_success 'grep -E pattern with grep.patternType=fixed' '
 	test_cmp expected actual
 '
 
-test_config() {
-	git config "$1" "$2" &&
-	test_when_finished "git config --unset $1"
-}
-
 cat >expected <<EOF
 hello.c<RED>:<RESET>int main(int argc, const char **argv)
 hello.c<RED>-<RESET>{
diff --git a/t/t7811-grep-open.sh b/t/t7811-grep-open.sh
index a895778..e1951a5 100755
--- a/t/t7811-grep-open.sh
+++ b/t/t7811-grep-open.sh
@@ -125,11 +125,6 @@ test_expect_success 'modified file' '
 	test_cmp empty out
 '
 
-test_config() {
-	git config "$1" "$2" &&
-	test_when_finished "git config --unset $1"
-}
-
 test_expect_success 'copes with color settings' '
 	rm -f actual &&
 	echo grep.h >expect &&
-- 
1.8.2

```

## Jonathan Nieder, 2013-03-20 18:40

Subject: Re: [PATCH] t: don't redefine test_config() in various places
Message-ID: <20130320184021.GN3655@google.com>
URL: https://gitlist.dev/e/20130320184021.GN3655%40google.com
In-Reply-To: <1363767703-12936-1-git-send-email-artagnon@gmail.com>

```
Ramkumar Ramachandra wrote:

> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  Thanks, Junio.
>
>  t/t4018-diff-funcname.sh | 5 -----
>  t/t7810-grep.sh          | 5 -----
>  t/t7811-grep-open.sh     | 5 -----
>  3 files changed, 15 deletions(-)

Yeah, that looks like all of them.  FWIW,
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

```

## Junio C Hamano, 2013-03-20 18:51

Subject: Re: [PATCH] t: don't redefine test_config() in various places
Message-ID: <7vsj3pewgl.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vsj3pewgl.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1363767703-12936-1-git-send-email-artagnon@gmail.com>

```
Ramkumar Ramachandra <artagnon@gmail.com> writes:

> test_config() is already a well-defined function in
> test-lib-functions.sh.  Don't duplicate it unnecessarily in:
>
>   t4018-diff-funcname.sh
>   t7810-grep.sh
>   t7811-grep-open.sh
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  Thanks, Junio.

Heh, I've pushed out the original one after fixing them up myself
last night.

```

## Ramkumar Ramachandra, 2013-03-20 19:59

Subject: Re: [PATCH] t: don't redefine test_config() in various places
Message-ID: <CALkWK0kwzE+Dk7qVim7S5ie_L+eGKS+iw+Q6HTUME0cHAcPdxQ@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0kwzE%2BDk7qVim7S5ie_L%2BeGKS%2Biw%2BQ6HTUME0cHAcPdxQ%40mail.gmail.com
In-Reply-To: <7vsj3pewgl.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano wrote:
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>
>> test_config() is already a well-defined function in
>> test-lib-functions.sh.  Don't duplicate it unnecessarily in:
>>
>>   t4018-diff-funcname.sh
>>   t7810-grep.sh
>>   t7811-grep-open.sh
>>
>> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
>> ---
>>  Thanks, Junio.
>
> Heh, I've pushed out the original one after fixing them up myself
> last night.

Doing a fine job as the editor, as always.  I need to watch `pu` more closely.

```
