git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH v2 1/4] git-completion.bash: separate some commands onto their own line
Date: Thu, 22 Apr 2021 03:00:49 -0700	[thread overview]
Message-ID: <65c485ea0c1726c96d292d7d7385def8d2f19f25.1619085387.git.liu.denton@gmail.com> (raw)
In-Reply-To: <cover.1619085387.git.liu.denton@gmail.com>

In e94fb44042 (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 <liu.denton@gmail.com>
---
 contrib/completion/git-completion.bash | 37 +++++++++++++++++++-------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index c926ca26c6..1dedb14b47 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3400,17 +3400,35 @@ __git_main ()
 	while [ $c -lt $cword ]; do
 		i="${words[c]}"
 		case "$i" in
-		--git-dir=*) __git_dir="${i#--git-dir=}" ;;
-		--git-dir)   ((c++)) ; __git_dir="${words[c]}" ;;
-		--bare)      __git_dir="." ;;
-		--help) command="help"; break ;;
-		-c|--work-tree|--namespace) ((c++)) ;;
-		-C)	__git_C_args[C_args_count++]=-C
+		--git-dir=*)
+			__git_dir="${i#--git-dir=}"
+			;;
+		--git-dir)
+			((c++))
+			__git_dir="${words[c]}"
+			;;
+		--bare)
+			__git_dir="."
+			;;
+		--help)
+			command="help"
+			break
+			;;
+		-c|--work-tree|--namespace)
+			((c++))
+			;;
+		-C)
+			__git_C_args[C_args_count++]=-C
 			((c++))
 			__git_C_args[C_args_count++]="${words[c]}"
 			;;
-		-*) ;;
-		*) command="$i"; __git_subcommand_idx="$c"; break ;;
+		-*)
+			;;
+		*)
+			command="$i"
+			__git_subcommand_idx="$c"
+			break
+			;;
 		esac
 		((c++))
 	done
@@ -3432,7 +3450,8 @@ __git_main ()
 			;;
 		esac
 		case "$cur" in
-		--*)   __gitcomp "
+		--*)
+			__gitcomp "
 			--paginate
 			--no-pager
 			--git-dir=
-- 
2.31.1.499.g90b4fd31cd


  reply	other threads:[~2021-04-22 10:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  9:19 [PATCH 0/5] git-completion.bash: fixes on top of 'dl/complete-stash' Denton Liu
2021-04-20  9:19 ` [PATCH 1/5] git-completion.bash: separate some commands onto their own line Denton Liu
2021-04-20  9:19 ` [PATCH 2/5] git-completion.bash: rename to $__git_cmd_idx Denton Liu
2021-04-20 20:50   ` Junio C Hamano
2021-04-20 21:14     ` SZEDER Gábor
2021-04-20 22:31       ` Junio C Hamano
2021-04-20  9:19 ` [PATCH 3/5] git-completion.bash: use $__git_cmd_idx in more places Denton Liu
2021-04-20  9:19 ` [PATCH 4/5] git-completion.bash: consolidate cases in _git_stash() Denton Liu
2021-04-20 10:44   ` Ævar Arnfjörð Bjarmason
2021-04-21  4:03     ` Denton Liu
2021-04-20  9:19 ` [PATCH 5/5] git-completion.bash: consolidate no-subcommand case for _git_stash() Denton Liu
2021-04-20 21:10   ` Junio C Hamano
2021-04-21  4:08     ` Denton Liu
2021-04-22 10:00 ` [PATCH v2 0/4] git-completion.bash: fixes on top of 'dl/complete-stash' Denton Liu
2021-04-22 10:00   ` Denton Liu [this message]
2021-04-22 10:00   ` [PATCH v2 2/4] git-completion.bash: rename to $__git_cmd_idx Denton Liu
2021-04-22 10:00   ` [PATCH v2 3/4] git-completion.bash: use $__git_cmd_idx in more places Denton Liu
2021-04-22 10:00   ` [PATCH v2 4/4] git-completion.bash: consolidate cases in _git_stash() Denton Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65c485ea0c1726c96d292d7d7385def8d2f19f25.1619085387.git.liu.denton@gmail.com \
    --to=liu.denton@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).