# [PATCH] branch test: fix invalid config key access

3 messages from 2017-05-28 to 2017-05-29. Participants: Sahil Dua, Ævar Arnfjörð Bjarmason, Junio C Hamano.
Thread: https://gitlist.dev/t/46063

## Sahil Dua, 2017-05-28 17:12

Subject: [PATCH] branch test: fix invalid config key access
Message-ID: <1495991536-71204-1-git-send-email-sahildua2305@gmail.com>
URL: https://gitlist.dev/e/1495991536-71204-1-git-send-email-sahildua2305%40gmail.com

```
Fixes the test by changing "branch.s/s/dummy" to "branch.s/s.dummy" which is
the right way of accessing config key "branch.s/s.dummy". Purpose of
this test is to confirm that this key doesn't exist after the branch
"s/s" has been renamed to "s".

Earlier it was trying to access invalid config key and hence was getting
an error. However, this wasn't caught because we were expecting the
command to fail for other reason as mentioned above.

Signed-off-by: Sahil Dua <sahildua2305@gmail.com>
---
 t/t3200-branch.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index fe62e7c..10f8f02 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -338,7 +338,7 @@ test_expect_success 'git branch -m s/s s should work when s/t is deleted' '
 
 test_expect_success 'config information was renamed, too' '
 	test $(git config branch.s.dummy) = Hello &&
-	test_must_fail git config branch.s/s/dummy
+	test_must_fail git config branch.s/s.dummy
 '
 
 test_expect_success 'deleting a symref' '
-- 
2.7.4 (Apple Git-66)


```

## Ævar Arnfjörð Bjarmason, 2017-05-28 17:33

Subject: Re: [PATCH] branch test: fix invalid config key access
Message-ID: <CACBZZX7J4xjw0ThSrQ-kG+KGiePZ-8vXET4cHEBOUFL8ydwE9A@mail.gmail.com>
URL: https://gitlist.dev/e/CACBZZX7J4xjw0ThSrQ-kG%2BKGiePZ-8vXET4cHEBOUFL8ydwE9A%40mail.gmail.com
In-Reply-To: <1495991536-71204-1-git-send-email-sahildua2305@gmail.com>

```
On Sun, May 28, 2017 at 7:12 PM, Sahil Dua <sahildua2305@gmail.com> wrote:
> Fixes the test by changing "branch.s/s/dummy" to "branch.s/s.dummy" which is
> the right way of accessing config key "branch.s/s.dummy". Purpose of
> this test is to confirm that this key doesn't exist after the branch
> "s/s" has been renamed to "s".
>
> Earlier it was trying to access invalid config key and hence was getting
> an error. However, this wasn't caught because we were expecting the
> command to fail for other reason as mentioned above.

Looks obviously correct to me. Added by Johannes in commit dc81c58cd6
("git-branch: rename config vars branch.<branch>.*, too", 2006-12-16),
CC-ing him in case he has anything to say about it, but just looks
like a typo back in 2006.

> Signed-off-by: Sahil Dua <sahildua2305@gmail.com>
> ---
>  t/t3200-branch.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
> index fe62e7c..10f8f02 100755
> --- a/t/t3200-branch.sh
> +++ b/t/t3200-branch.sh
> @@ -338,7 +338,7 @@ test_expect_success 'git branch -m s/s s should work when s/t is deleted' '
>
>  test_expect_success 'config information was renamed, too' '
>         test $(git config branch.s.dummy) = Hello &&
> -       test_must_fail git config branch.s/s/dummy
> +       test_must_fail git config branch.s/s.dummy
>  '
>
>  test_expect_success 'deleting a symref' '
> --
> 2.7.4 (Apple Git-66)
>

```

## Junio C Hamano, 2017-05-29 01:13

Subject: Re: [PATCH] branch test: fix invalid config key access
Message-ID: <xmqqzidw8ny7.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqzidw8ny7.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CACBZZX7J4xjw0ThSrQ-kG+KGiePZ-8vXET4cHEBOUFL8ydwE9A@mail.gmail.com>

```
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> On Sun, May 28, 2017 at 7:12 PM, Sahil Dua <sahildua2305@gmail.com> wrote:
>> Fixes the test by changing "branch.s/s/dummy" to "branch.s/s.dummy" which is
>> the right way of accessing config key "branch.s/s.dummy". Purpose of
>> this test is to confirm that this key doesn't exist after the branch
>> "s/s" has been renamed to "s".
>>
>> Earlier it was trying to access invalid config key and hence was getting
>> an error. However, this wasn't caught because we were expecting the
>> command to fail for other reason as mentioned above.
>
> Looks obviously correct to me. Added by Johannes in commit dc81c58cd6
> ("git-branch: rename config vars branch.<branch>.*, too", 2006-12-16),
> CC-ing him in case he has anything to say about it, but just looks
> like a typo back in 2006.

Yeah, it does look like a simple typo.  Sorry for not spotting it
back then.


>> Signed-off-by: Sahil Dua <sahildua2305@gmail.com>
>> ---
>>  t/t3200-branch.sh | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
>> index fe62e7c..10f8f02 100755
>> --- a/t/t3200-branch.sh
>> +++ b/t/t3200-branch.sh
>> @@ -338,7 +338,7 @@ test_expect_success 'git branch -m s/s s should work when s/t is deleted' '
>>
>>  test_expect_success 'config information was renamed, too' '
>>         test $(git config branch.s.dummy) = Hello &&
>> -       test_must_fail git config branch.s/s/dummy
>> +       test_must_fail git config branch.s/s.dummy
>>  '
>>
>>  test_expect_success 'deleting a symref' '
>> --
>> 2.7.4 (Apple Git-66)
>>

```
