# [PATCH v1 1/1] completion: add remaining flags to checkout

8 messages from 2017-10-12 to 2017-10-25. Participants: Thomas Braun, Johannes Sixt, Junio C Hamano.
Thread: https://gitlist.dev/t/46957

## Thomas Braun, 2017-10-12 12:20

Subject: [PATCH v1 1/1] completion: add remaining flags to checkout
Message-ID: <20171012122059.17242-1-thomas.braun@virtuell-zuhause.de>
URL: https://gitlist.dev/e/20171012122059.17242-1-thomas.braun%40virtuell-zuhause.de

```
In the commits 1d0fa898 (checkout: add --ignore-other-wortrees,
2015-01-03), 1fc458d9 (builtin/checkout: add --recurse-submodules switch,
2017-03-14), 870ebdb9 (checkout: add --progress option, 2015-11-01),
08d595dc (checkout: add --ignore-skip-worktree-bits in sparse checkout
mode, 2013-04-13), 1d0fa898 (checkout: add --ignore-other-wortrees,
2015-01-03), 32669671 (checkout: introduce --detach synonym for "git
checkout foo^{commit}", 2011-02-08) and db941099 (checkout -f: allow
ignoring unmerged paths when checking out of the index, 2008-08-30)
checkout gained new flags but the completion was not updated, although
these flags are useful completions. Add them.

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
---
 contrib/completion/git-completion.bash | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d934417475..393d4ae230 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1250,7 +1250,9 @@ _git_checkout ()
 	--*)
 		__gitcomp "
 			--quiet --ours --theirs --track --no-track --merge
-			--conflict= --orphan --patch
+			--conflict= --orphan --patch --detach --progress --no-progress
+			--force --ignore-skip-worktree-bits --ignore-other-worktrees
+			--recurse-submodules --no-recurse-submodules
 			"
 		;;
 	*)
-- 
2.15.0.rc0.245.g6d586db062


```

## Johannes Sixt, 2017-10-12 16:50

Subject: Re: [PATCH v1 1/1] completion: add remaining flags to checkout
Message-ID: <5bc82075-0fb2-0929-2da7-d9069222a3fe@kdbg.org>
URL: https://gitlist.dev/e/5bc82075-0fb2-0929-2da7-d9069222a3fe%40kdbg.org
In-Reply-To: <20171012122059.17242-1-thomas.braun@virtuell-zuhause.de>

```
Am 12.10.2017 um 14:20 schrieb Thomas Braun:
> In the commits 1d0fa898 (checkout: add --ignore-other-wortrees,
> 2015-01-03), 1fc458d9 (builtin/checkout: add --recurse-submodules switch,
> 2017-03-14), 870ebdb9 (checkout: add --progress option, 2015-11-01),
> 08d595dc (checkout: add --ignore-skip-worktree-bits in sparse checkout
> mode, 2013-04-13), 1d0fa898 (checkout: add --ignore-other-wortrees,
> 2015-01-03), 32669671 (checkout: introduce --detach synonym for "git
> checkout foo^{commit}", 2011-02-08) and db941099 (checkout -f: allow
> ignoring unmerged paths when checking out of the index, 2008-08-30)
> checkout gained new flags but the completion was not updated, although
> these flags are useful completions. Add them.
> 
> Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
> ---
>   contrib/completion/git-completion.bash | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index d934417475..393d4ae230 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1250,7 +1250,9 @@ _git_checkout ()
>   	--*)
>   		__gitcomp "
>   			--quiet --ours --theirs --track --no-track --merge
> -			--conflict= --orphan --patch
> +			--conflict= --orphan --patch --detach --progress --no-progress
> +			--force --ignore-skip-worktree-bits --ignore-other-worktrees

Destructive and dangerous options are typically not offered by command 
completion. You should omit all three in the line above, IMO.

Furthermore, --progress and --no-progress are not useful in daily work 
on the command line, I think. By offering them, --p<TAB> would not 
complete to --patch anymore, you would need --pa<TAB>. You should omit 
them, too.

> +			--recurse-submodules --no-recurse-submodules
>   			"
>   		;;
>   	*)
> 

-- Hannes

```

## Johannes Sixt, 2017-10-12 20:30

Subject: Re: [PATCH v1 1/1] completion: add remaining flags to checkout
Message-ID: <d1bbd196-ad9f-cb22-a363-43b113a354ce@kdbg.org>
URL: https://gitlist.dev/e/d1bbd196-ad9f-cb22-a363-43b113a354ce%40kdbg.org
In-Reply-To: <5bc82075-0fb2-0929-2da7-d9069222a3fe@kdbg.org>

```
Am 12.10.2017 um 18:50 schrieb Johannes Sixt:
> Am 12.10.2017 um 14:20 schrieb Thomas Braun:
>> +            --force --ignore-skip-worktree-bits --ignore-other-worktrees
> 
> Destructive and dangerous options are typically not offered by command 
> completion. You should omit all three in the line above, IMO.

Ah, no, only --force and --ignore-other-worktrees are dangerous, 
--ignore-skip-worktree-bits is not.

-- Hannes

```

## Thomas Braun, 2017-10-24 13:18

Subject: Re: [PATCH v1 1/1] completion: add remaining flags to checkout
Message-ID: <1989036170.30614.1508851107354@ox.hosteurope.de>
URL: https://gitlist.dev/e/1989036170.30614.1508851107354%40ox.hosteurope.de
In-Reply-To: <5bc82075-0fb2-0929-2da7-d9069222a3fe@kdbg.org>

```

> Johannes Sixt <j6t@kdbg.org> hat am 12. Oktober 2017 um 18:50 geschrieben:
> 
> 
> Am 12.10.2017 um 14:20 schrieb Thomas Braun:
> > In the commits 1d0fa898 (checkout: add --ignore-other-wortrees,
> > 2015-01-03), 1fc458d9 (builtin/checkout: add --recurse-submodules switch,
> > 2017-03-14), 870ebdb9 (checkout: add --progress option, 2015-11-01),
> > 08d595dc (checkout: add --ignore-skip-worktree-bits in sparse checkout
> > mode, 2013-04-13), 1d0fa898 (checkout: add --ignore-other-wortrees,
> > 2015-01-03), 32669671 (checkout: introduce --detach synonym for "git
> > checkout foo^{commit}", 2011-02-08) and db941099 (checkout -f: allow
> > ignoring unmerged paths when checking out of the index, 2008-08-30)
> > checkout gained new flags but the completion was not updated, although
> > these flags are useful completions. Add them.
> > 
> > Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
> > ---
> >   contrib/completion/git-completion.bash | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> > index d934417475..393d4ae230 100644
> > --- a/contrib/completion/git-completion.bash
> > +++ b/contrib/completion/git-completion.bash
> > @@ -1250,7 +1250,9 @@ _git_checkout ()
> >   	--*)
> >   		__gitcomp "
> >   			--quiet --ours --theirs --track --no-track --merge
> > -			--conflict= --orphan --patch
> > +			--conflict= --orphan --patch --detach --progress --no-progress
> > +			--force --ignore-skip-worktree-bits --ignore-other-worktrees
> 
> Destructive and dangerous options are typically not offered by command 
> completion. You should omit all three in the line above, IMO.
> 
> Furthermore, --progress and --no-progress are not useful in daily work 
> on the command line, I think. By offering them, --p<TAB> would not 
> complete to --patch anymore, you would need --pa<TAB>. You should omit 
> them, too.

Thanks for the review.

I've fixed that for the next reroll.

```

## Thomas Braun, 2017-10-24 13:19

Subject: [PATCH v2 1/1] completion: add remaining flags to checkout
Message-ID: <20171024131931.18221-1-thomas.braun@virtuell-zuhause.de>
URL: https://gitlist.dev/e/20171024131931.18221-1-thomas.braun%40virtuell-zuhause.de
In-Reply-To: <20171012122059.17242-1-thomas.braun@virtuell-zuhause.de>

```
In the commits 1fc458d9 (builtin/checkout: add --recurse-submodules
switch, 2017-03-14), 08d595dc (checkout: add --ignore-skip-worktree-bits
in sparse checkout mode, 2013-04-13) and 32669671 (checkout: introduce
--detach synonym for "git checkout foo^{commit}", 2011-02-08) checkout
gained new flags but the completion was not updated, although these flags
are useful completions. Add them.

The flags --force and --ignore-other-worktrees are not added as they are
potentially dangerous.

The flags --progress and --no-progress are only useful for scripting and are
therefore also not included.

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
---
 contrib/completion/git-completion.bash | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d934417475..eb6ade6974 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1250,7 +1250,8 @@ _git_checkout ()
 	--*)
 		__gitcomp "
 			--quiet --ours --theirs --track --no-track --merge
-			--conflict= --orphan --patch
+			--conflict= --orphan --patch --detach --ignore-skip-worktree-bits
+			--recurse-submodules --no-recurse-submodules
 			"
 		;;
 	*)
-- 
2.15.0.rc0.245.g6d586db062


```

## Johannes Sixt, 2017-10-24 16:45

Subject: Re: [PATCH v2 1/1] completion: add remaining flags to checkout
Message-ID: <be2e0547-5ef7-c9d9-baad-44f5fa9d3c31@kdbg.org>
URL: https://gitlist.dev/e/be2e0547-5ef7-c9d9-baad-44f5fa9d3c31%40kdbg.org
In-Reply-To: <20171024131931.18221-1-thomas.braun@virtuell-zuhause.de>

```
Am 24.10.2017 um 15:19 schrieb Thomas Braun:
> In the commits 1fc458d9 (builtin/checkout: add --recurse-submodules
> switch, 2017-03-14), 08d595dc (checkout: add --ignore-skip-worktree-bits
> in sparse checkout mode, 2013-04-13) and 32669671 (checkout: introduce
> --detach synonym for "git checkout foo^{commit}", 2011-02-08) checkout
> gained new flags but the completion was not updated, although these flags
> are useful completions. Add them.
> 
> The flags --force and --ignore-other-worktrees are not added as they are
> potentially dangerous.
> 
> The flags --progress and --no-progress are only useful for scripting and are
> therefore also not included.
> 
> Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
> ---
>   contrib/completion/git-completion.bash | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index d934417475..eb6ade6974 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1250,7 +1250,8 @@ _git_checkout ()
>   	--*)
>   		__gitcomp "
>   			--quiet --ours --theirs --track --no-track --merge
> -			--conflict= --orphan --patch
> +			--conflict= --orphan --patch --detach --ignore-skip-worktree-bits
> +			--recurse-submodules --no-recurse-submodules
>   			"
>   		;;
>   	*)
> 

Looks good to me. Thanks,
-- Hannes


```

## Junio C Hamano, 2017-10-25 06:03

Subject: Re: [PATCH v2 1/1] completion: add remaining flags to checkout
Message-ID: <xmqqefprix2c.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqefprix2c.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <be2e0547-5ef7-c9d9-baad-44f5fa9d3c31@kdbg.org>

```
Johannes Sixt <j6t@kdbg.org> writes:

>> The flags --force and --ignore-other-worktrees are not added as they are
>> potentially dangerous.
>>
>> The flags --progress and --no-progress are only useful for scripting and are
>> therefore also not included.
>>
>> Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
>> ---
>>   contrib/completion/git-completion.bash | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index d934417475..eb6ade6974 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -1250,7 +1250,8 @@ _git_checkout ()
>>   	--*)
>>   		__gitcomp "
>>   			--quiet --ours --theirs --track --no-track --merge
>> -			--conflict= --orphan --patch
>> +			--conflict= --orphan --patch --detach --ignore-skip-worktree-bits
>> +			--recurse-submodules --no-recurse-submodules
>>   			"
>>   		;;
>>   	*)
>>
>
> Looks good to me. Thanks,
> -- Hannes

Doesn't quite.  This breaks t9902, doesn't it?

```

## Junio C Hamano, 2017-10-25 06:22

Subject: Re: [PATCH v2 1/1] completion: add remaining flags to checkout
Message-ID: <xmqqa80fiw5m.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqa80fiw5m.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <xmqqefprix2c.fsf@gitster.mtv.corp.google.com>

```
Junio C Hamano <gitster@pobox.com> writes:

> Johannes Sixt <j6t@kdbg.org> writes:
>
>>> The flags --force and --ignore-other-worktrees are not added as they are
>>> potentially dangerous.
>>>
>>> The flags --progress and --no-progress are only useful for scripting and are
>>> therefore also not included.
>>>
>>> Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
>>> ---
>>>   contrib/completion/git-completion.bash | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>>> index d934417475..eb6ade6974 100644
>>> --- a/contrib/completion/git-completion.bash
>>> +++ b/contrib/completion/git-completion.bash
>>> @@ -1250,7 +1250,8 @@ _git_checkout ()
>>>   	--*)
>>>   		__gitcomp "
>>>   			--quiet --ours --theirs --track --no-track --merge
>>> -			--conflict= --orphan --patch
>>> +			--conflict= --orphan --patch --detach --ignore-skip-worktree-bits
>>> +			--recurse-submodules --no-recurse-submodules
>>>   			"
>>>   		;;
>>>   	*)
>>>
>>
>> Looks good to me. Thanks,
>> -- Hannes
>
> Doesn't quite.  This breaks t9902, doesn't it?

I've queued it with the following squashed in.

 t/t9902-completion.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 2cb999ecfa..fc614dcbfa 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1245,6 +1245,10 @@ test_expect_success 'double dash "git checkout"' '
 	--conflict=
 	--orphan Z
 	--patch Z
+	--detach Z
+	--ignore-skip-worktree-bits Z
+	--recurse-submodules Z
+	--no-recurse-submodules Z
 	EOF
 '
 

```
