threads / patch / 42538

patchcompletion: complete --move for git branch

Subject: [PATCH] completion: complete --move for git branch

## tl;dr

6 messages between Jun 6, 2016 and Aug 9, 2016. Diffs are folded; open one to read it.

replies: 5people: 3as markdown or json

Ville Skyttä· Jun 6, 2016, 13:16 UTC · lore
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
---
 contrib/completion/git-completion.bash | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Show changes to contrib/completion/git-completion.bash +3 −3
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3402475..6918cc8 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -964,8 +964,8 @@ _git_branch ()
 	while [ $c -lt $cword ]; do
 		i="${words[c]}"
 		case "$i" in
-		-d|-m)	only_local_ref="y" ;;
-		-r)	has_r="y" ;;
+		-d|-m|--move)	only_local_ref="y" ;;
+		-r)		has_r="y" ;;
 		esac
 		((c++))
 	done
@@ -979,7 +979,7 @@ _git_branch ()
 			--color --no-color --verbose --abbrev= --no-abbrev
 			--track --no-track --contains --merged --no-merged
 			--set-upstream-to= --edit-description --list
-			--unset-upstream
+			--unset-upstream --move
 			"
 		;;
 	*)
-- 
2.5.5
Remi Galan Alfonso· Jun 6, 2016, 14:16 UTC · re: Ville Skyttä · lore

Re: [PATCH] completion: complete --move for git branch

Hi,
Ville Skyttä <ville.skytta@iki.fi> writes:
Show 6 quoted lines
>          while [ $c -lt $cword ]; do
>                  i="${words[c]}"
>                  case "$i" in
> -                -d|-m)        only_local_ref="y" ;;
> -                -r)        has_r="y" ;;
> +                -d|-m|--move)        only_local_ref="y" ;;

"While you're at it" you might want to do the same thing for `--delete`.

> +                -r)                has_r="y" ;;

You are introducing an additional tab here that you probably didn't want.

Show 12 quoted lines
>                  esac
>                  ((c++))
>          done
> @@ -979,7 +979,7 @@ _git_branch ()
>                          --color --no-color --verbose --abbrev= --no-abbrev
>                          --track --no-track --contains --merged --no-merged
>                          --set-upstream-to= --edit-description --list
> -                        --unset-upstream
> +                        --unset-upstream --move
>                          "
>                  ;;
>          *)

Thanks, Rémi

Ville Skyttä· Jun 6, 2016, 16:19 UTC · re: Remi Galan Alfonso · lore

Re: [PATCH] completion: complete --move for git branch

On Mon, Jun 6, 2016 at 5:16 PM, Remi Galan Alfonso <remi.galan-alfonso@ensimag.grenoble-inp.fr> wrote:

Show 13 quoted lines
>
> Hi,
>
> Ville Skyttä <ville.skytta@iki.fi> writes:
> >          while [ $c -lt $cword ]; do
> >                  i="${words[c]}"
> >                  case "$i" in
> > -                -d|-m)        only_local_ref="y" ;;
> > -                -r)        has_r="y" ;;
> > +                -d|-m|--move)        only_local_ref="y" ;;
>
> "While you're at it" you might want to do the same thing for
> `--delete`.

I'm afraid the "while I'm at it" would never end if I start looking deeper into missing things there, so I'd prefer this self contained one I keep running into myself applied first.

> > +                -r)                has_r="y" ;;
>
> You are introducing an additional tab here that you probably didn't
> want.

It was intentionally added it to keep "only_local_ref" and "has_r" tab-aligned the way they already were.

Remi Galan Alfonso· Jun 7, 2016, 09:16 UTC · re: Ville Skyttä · lore

Re: [PATCH] completion: complete --move for git branch

Ville Skyttä <ville.skytta@iki.fi> writes:
Show 19 quoted lines
> On Mon, Jun 6, 2016 at 5:16 PM, Remi Galan Alfonso
> <remi.galan-alfonso@ensimag.grenoble-inp.fr> wrote:
> >
> > Hi,
> >
> > Ville Skyttä <ville.skytta@iki.fi> writes:
> > >          while [ $c -lt $cword ]; do
> > >                  i="${words[c]}"
> > >                  case "$i" in
> > > -                -d|-m)        only_local_ref="y" ;;
> > > -                -r)        has_r="y" ;;
> > > +                -d|-m|--move)        only_local_ref="y" ;;
> >
> > "While you're at it" you might want to do the same thing for
> > `--delete`.
> 
> I'm afraid the "while I'm at it" would never end if I start looking
> deeper into missing things there, so I'd prefer this self contained
> one I keep running into myself applied first.

I understand, though adding `--delete` here makes sense since there is already the short-hand `-d` that is tested (like you added `--move` since the short-hand `-m` is tested). However adding it here means that we should also add it in completion list below. Thinking about it, it might be better to have it in a separate patch, so no further objections with this patch.

Show 8 quoted lines
> 
> > > +                -r)                has_r="y" ;;
> >
> > You are introducing an additional tab here that you probably didn't
> > want.
> 
> It was intentionally added it to keep "only_local_ref" and "has_r"
> tab-aligned the way they already were.
Ah indeed, my bad, I didn't see it.

Thanks, Rémi

Ville Skyttä· Aug 9, 2016, 09:34 UTC · re: Remi Galan Alfonso · lore

[PATCH v2] completion: complete --delete, --move, and --remotes for git branch

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
---
 contrib/completion/git-completion.bash | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Show changes to contrib/completion/git-completion.bash +3 −3
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6a187bc..76abbd1 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1008,8 +1008,8 @@ _git_branch ()
 	while [ $c -lt $cword ]; do
 		i="${words[c]}"
 		case "$i" in
-		-d|-m)	only_local_ref="y" ;;
-		-r)	has_r="y" ;;
+		-d|--delete|-m|--move)	only_local_ref="y" ;;
+		-r|--remotes)		has_r="y" ;;
 		esac
 		((c++))
 	done
@@ -1023,7 +1023,7 @@ _git_branch ()
 			--color --no-color --verbose --abbrev= --no-abbrev
 			--track --no-track --contains --merged --no-merged
 			--set-upstream-to= --edit-description --list
-			--unset-upstream
+			--unset-upstream --delete --move --remotes
 			"
 		;;
 	*)
-- 
2.5.5
Junio C Hamano· Aug 9, 2016, 18:30 UTC · re: Ville Skyttä · lore

Re: [PATCH v2] completion: complete --delete, --move, and --remotes for git branch

Ville Skyttä <ville.skytta@iki.fi> writes:
Show 20 quoted lines
> Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
> ---
>  contrib/completion/git-completion.bash | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 6a187bc..76abbd1 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1008,8 +1008,8 @@ _git_branch ()
>  	while [ $c -lt $cword ]; do
>  		i="${words[c]}"
>  		case "$i" in
> -		-d|-m)	only_local_ref="y" ;;
> -		-r)	has_r="y" ;;
> +		-d|--delete|-m|--move)	only_local_ref="y" ;;
> +		-r|--remotes)		has_r="y" ;;
>  		esac
>  		((c++))
>  	done

Sounds sensible; we already had "-d" but not its fully-spelled variant, and you are adding it (together with its friends).

Will queue.
Show 9 quoted lines
> @@ -1023,7 +1023,7 @@ _git_branch ()
>  			--color --no-color --verbose --abbrev= --no-abbrev
>  			--track --no-track --contains --merged --no-merged
>  			--set-upstream-to= --edit-description --list
> -			--unset-upstream
> +			--unset-upstream --delete --move --remotes
>  			"
>  		;;
>  	*)

← back to recent threads