Skip to content

Commit 8c8c8c0

Browse files
Denton-Lgitster
authored andcommitted
git-completion.bash: separate some commands onto their own line
In e94fb44 (git-completion.bash: pass $__git_subcommand_idx from __git_main(), 2021-03-24), a line was introduced which contained multiple statements. This is difficult to read so break it into multiple lines. While we're at it, follow this convention for the rest of the __git_main() and break up lines that contain multiple statements. Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6131807 commit 8c8c8c0

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

contrib/completion/git-completion.bash

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,17 +3400,35 @@ __git_main ()
34003400
while [ $c -lt $cword ]; do
34013401
i="${words[c]}"
34023402
case "$i" in
3403-
--git-dir=*) __git_dir="${i#--git-dir=}" ;;
3404-
--git-dir) ((c++)) ; __git_dir="${words[c]}" ;;
3405-
--bare) __git_dir="." ;;
3406-
--help) command="help"; break ;;
3407-
-c|--work-tree|--namespace) ((c++)) ;;
3408-
-C) __git_C_args[C_args_count++]=-C
3403+
--git-dir=*)
3404+
__git_dir="${i#--git-dir=}"
3405+
;;
3406+
--git-dir)
3407+
((c++))
3408+
__git_dir="${words[c]}"
3409+
;;
3410+
--bare)
3411+
__git_dir="."
3412+
;;
3413+
--help)
3414+
command="help"
3415+
break
3416+
;;
3417+
-c|--work-tree|--namespace)
3418+
((c++))
3419+
;;
3420+
-C)
3421+
__git_C_args[C_args_count++]=-C
34093422
((c++))
34103423
__git_C_args[C_args_count++]="${words[c]}"
34113424
;;
3412-
-*) ;;
3413-
*) command="$i"; __git_subcommand_idx="$c"; break ;;
3425+
-*)
3426+
;;
3427+
*)
3428+
command="$i"
3429+
__git_subcommand_idx="$c"
3430+
break
3431+
;;
34143432
esac
34153433
((c++))
34163434
done
@@ -3432,7 +3450,8 @@ __git_main ()
34323450
;;
34333451
esac
34343452
case "$cur" in
3435-
--*) __gitcomp "
3453+
--*)
3454+
__gitcomp "
34363455
--paginate
34373456
--no-pager
34383457
--git-dir=

0 commit comments

Comments
 (0)