Re: [PATCH 4/4] git-prompt.sh: add tests for submodule indicator

2017-01-31 Thread Junio C Hamano
SZEDER Gábor  writes:

> On Mon, Jan 30, 2017 at 9:44 PM, Benjamin Fuchs  
> wrote:
>> Signed-off-by: Benjamin Fuchs 
>> ---
>>  t/t9903-bash-prompt.sh | 43 +++
>>  1 file changed, 43 insertions(+)
>>
>> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
>> index 97c9b32..4dce366 100755
>> --- a/t/t9903-bash-prompt.sh
>> +++ b/t/t9903-bash-prompt.sh
>> @@ -37,6 +37,11 @@ test_expect_success 'setup for prompt tests' '
>> git commit -m "yet another b2" file &&
>> mkdir ignored_dir &&
>> echo "ignored_dir/" >>.gitignore &&
>> +   git checkout -b submodule &&
>> +   git submodule add ./. sub &&
>
> ./. ?

Good eyes.  This is a pattern we are trying to wean ourselves off
of.  E.g. cf.

https://public-inbox.org/git/20170105192904.1107-2-sbel...@google.com/#t

Hopefully this reminds us to resurrect and finish the test fixes in
that thread?


Re: [PATCH 4/4] git-prompt.sh: add tests for submodule indicator

2017-01-31 Thread Stefan Beller
On Tue, Jan 31, 2017 at 2:06 PM, Junio C Hamano  wrote:
> SZEDER Gábor  writes:
>
>> On Mon, Jan 30, 2017 at 9:44 PM, Benjamin Fuchs  
>> wrote:
>>> Signed-off-by: Benjamin Fuchs 
>>> ---
>>>  t/t9903-bash-prompt.sh | 43 +++
>>>  1 file changed, 43 insertions(+)
>>>
>>> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
>>> index 97c9b32..4dce366 100755
>>> --- a/t/t9903-bash-prompt.sh
>>> +++ b/t/t9903-bash-prompt.sh
>>> @@ -37,6 +37,11 @@ test_expect_success 'setup for prompt tests' '
>>> git commit -m "yet another b2" file &&
>>> mkdir ignored_dir &&
>>> echo "ignored_dir/" >>.gitignore &&
>>> +   git checkout -b submodule &&
>>> +   git submodule add ./. sub &&
>>
>> ./. ?
>
> Good eyes.  This is a pattern we are trying to wean ourselves off
> of.  E.g. cf.
>
> https://public-inbox.org/git/20170105192904.1107-2-sbel...@google.com/#t
>
> Hopefully this reminds us to resurrect and finish the test fixes in
> that thread?

I plan to eventually, yes. but that is a refactoring, that has lower prio
than getting checkout working recursing into submodules.


Re: [PATCH 4/4] git-prompt.sh: add tests for submodule indicator

2017-01-31 Thread SZEDER Gábor
On Mon, Jan 30, 2017 at 9:44 PM, Benjamin Fuchs  wrote:
> Signed-off-by: Benjamin Fuchs 
> ---
>  t/t9903-bash-prompt.sh | 43 +++
>  1 file changed, 43 insertions(+)
>
> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
> index 97c9b32..4dce366 100755
> --- a/t/t9903-bash-prompt.sh
> +++ b/t/t9903-bash-prompt.sh
> @@ -37,6 +37,11 @@ test_expect_success 'setup for prompt tests' '
> git commit -m "yet another b2" file &&
> mkdir ignored_dir &&
> echo "ignored_dir/" >>.gitignore &&
> +   git checkout -b submodule &&
> +   git submodule add ./. sub &&

./. ?

> +   git -C sub checkout master &&
> +   git add sub &&
> +   git commit -m submodule &&
> git checkout master
>  '
>
> @@ -755,4 +760,42 @@ test_expect_success 'prompt - hide if pwd ignored - 
> inside gitdir (stderr)' '
> test_cmp expected "$actual"
>  '
>
> +test_expect_success 'prompt - submodule indicator' '
> +   printf " (sub:master)" >expected &&
> +   git checkout submodule &&
> +   test_when_finished "git checkout master" &&
> +   (
> +   cd sub &&
> +   GIT_PS1_SHOWSUBMODULE=1 &&
> +   __git_ps1 >"$actual"
> +   ) &&
> +   test_cmp expected "$actual"
> +'
> +
> +test_expect_success 'prompt - submodule indicator - verify false' '

I was puzzled by the "verify false" here.  You mean "disabled", right?

> +   printf " (master)" >expected &&
> +   git checkout submodule &&
> +   test_when_finished "git checkout master" &&
> +   (
> +   cd sub &&
> +   GIT_PS1_SHOWSUBMODULE= &&
> +   __git_ps1 >"$actual"
> +   ) &&
> +   test_cmp expected "$actual"
> +'
> +
> +test_expect_success 'prompt - submodule indicator - dirty status indicator' '
> +   printf " (+sub:b1)" >expected &&
> +   git checkout submodule &&
> +   git -C sub checkout b1 &&
> +   test_when_finished "git checkout master" &&
> +   (
> +   cd sub &&
> +   GIT_PS1_SHOWSUBMODULE=1 &&
> +   __git_ps1 >"$actual"
> +   ) &&
> +   test_cmp expected "$actual"
> +'
> +
> +
>  test_done
> --
> 2.7.4
>


[PATCH 4/4] git-prompt.sh: add tests for submodule indicator

2017-01-30 Thread Benjamin Fuchs
Signed-off-by: Benjamin Fuchs 
---
 t/t9903-bash-prompt.sh | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 97c9b32..4dce366 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -37,6 +37,11 @@ test_expect_success 'setup for prompt tests' '
git commit -m "yet another b2" file &&
mkdir ignored_dir &&
echo "ignored_dir/" >>.gitignore &&
+   git checkout -b submodule &&
+   git submodule add ./. sub &&
+   git -C sub checkout master &&
+   git add sub &&
+   git commit -m submodule &&
git checkout master
 '
 
@@ -755,4 +760,42 @@ test_expect_success 'prompt - hide if pwd ignored - inside 
gitdir (stderr)' '
test_cmp expected "$actual"
 '
 
+test_expect_success 'prompt - submodule indicator' '
+   printf " (sub:master)" >expected &&
+   git checkout submodule &&
+   test_when_finished "git checkout master" &&
+   (
+   cd sub &&
+   GIT_PS1_SHOWSUBMODULE=1 &&
+   __git_ps1 >"$actual"
+   ) &&
+   test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - submodule indicator - verify false' '
+   printf " (master)" >expected &&
+   git checkout submodule &&
+   test_when_finished "git checkout master" &&
+   (
+   cd sub &&
+   GIT_PS1_SHOWSUBMODULE= &&
+   __git_ps1 >"$actual"
+   ) &&
+   test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - submodule indicator - dirty status indicator' '
+   printf " (+sub:b1)" >expected &&
+   git checkout submodule &&
+   git -C sub checkout b1 &&
+   test_when_finished "git checkout master" &&
+   (
+   cd sub &&
+   GIT_PS1_SHOWSUBMODULE=1 &&
+   __git_ps1 >"$actual"
+   ) &&
+   test_cmp expected "$actual"
+'
+
+
 test_done
-- 
2.7.4



[PATCH 4/4] git-prompt.sh: add tests for submodule indicator

2017-01-22 Thread Benjamin Fuchs
---
 t/t9903-bash-prompt.sh | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 97c9b32..4dce366 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -37,6 +37,11 @@ test_expect_success 'setup for prompt tests' '
git commit -m "yet another b2" file &&
mkdir ignored_dir &&
echo "ignored_dir/" >>.gitignore &&
+   git checkout -b submodule &&
+   git submodule add ./. sub &&
+   git -C sub checkout master &&
+   git add sub &&
+   git commit -m submodule &&
git checkout master
 '
 
@@ -755,4 +760,42 @@ test_expect_success 'prompt - hide if pwd ignored - inside 
gitdir (stderr)' '
test_cmp expected "$actual"
 '
 
+test_expect_success 'prompt - submodule indicator' '
+   printf " (sub:master)" >expected &&
+   git checkout submodule &&
+   test_when_finished "git checkout master" &&
+   (
+   cd sub &&
+   GIT_PS1_SHOWSUBMODULE=1 &&
+   __git_ps1 >"$actual"
+   ) &&
+   test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - submodule indicator - verify false' '
+   printf " (master)" >expected &&
+   git checkout submodule &&
+   test_when_finished "git checkout master" &&
+   (
+   cd sub &&
+   GIT_PS1_SHOWSUBMODULE= &&
+   __git_ps1 >"$actual"
+   ) &&
+   test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - submodule indicator - dirty status indicator' '
+   printf " (+sub:b1)" >expected &&
+   git checkout submodule &&
+   git -C sub checkout b1 &&
+   test_when_finished "git checkout master" &&
+   (
+   cd sub &&
+   GIT_PS1_SHOWSUBMODULE=1 &&
+   __git_ps1 >"$actual"
+   ) &&
+   test_cmp expected "$actual"
+'
+
+
 test_done
-- 
2.7.4