From: Denton Liu <liu.denton@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 1/3] git-completion.bash: extract from else in _git_stash()
Date: Mon, 15 Mar 2021 17:54:18 -0700 [thread overview]
Message-ID: <a2d9bc4a6651ea5212ebf7a3ea5441bbd58c1aca.1615855962.git.liu.denton@gmail.com> (raw)
In-Reply-To: <cover.1615855962.git.liu.denton@gmail.com>
To save a level of indentation, perform an early return in the "if" arm
so we can move the "else" code out of the block.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
contrib/completion/git-completion.bash | 73 +++++++++++++-------------
1 file changed, 37 insertions(+), 36 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 7dc6cd8eb8..fe79f6b71c 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3035,44 +3035,45 @@ _git_stash ()
fi
;;
esac
- else
- case "$subcommand,$cur" in
- push,--*)
- __gitcomp "$save_opts --message"
- ;;
- save,--*)
- __gitcomp "$save_opts"
- ;;
- apply,--*|pop,--*)
- __gitcomp "--index --quiet"
- ;;
- drop,--*)
- __gitcomp "--quiet"
- ;;
- list,--*)
- __gitcomp "--name-status --oneline --patch-with-stat"
- ;;
- show,--*)
- __gitcomp "$__git_diff_common_options"
- ;;
- branch,--*)
- ;;
- branch,*)
- if [ $cword -eq 3 ]; then
- __git_complete_refs
- else
- __gitcomp_nl "$(__git stash list \
- | sed -n -e 's/:.*//p')"
- fi
- ;;
- show,*|apply,*|drop,*|pop,*)
+ return
+ fi
+
+ case "$subcommand,$cur" in
+ push,--*)
+ __gitcomp "$save_opts --message"
+ ;;
+ save,--*)
+ __gitcomp "$save_opts"
+ ;;
+ apply,--*|pop,--*)
+ __gitcomp "--index --quiet"
+ ;;
+ drop,--*)
+ __gitcomp "--quiet"
+ ;;
+ list,--*)
+ __gitcomp "--name-status --oneline --patch-with-stat"
+ ;;
+ show,--*)
+ __gitcomp "$__git_diff_common_options"
+ ;;
+ branch,--*)
+ ;;
+ branch,*)
+ if [ $cword -eq 3 ]; then
+ __git_complete_refs
+ else
__gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
- ;;
- *)
- ;;
- esac
- fi
+ fi
+ ;;
+ show,*|apply,*|drop,*|pop,*)
+ __gitcomp_nl "$(__git stash list \
+ | sed -n -e 's/:.*//p')"
+ ;;
+ *)
+ ;;
+ esac
}
_git_submodule ()
--
2.31.0.rc2.261.g7f71774620
next prev parent reply other threads:[~2021-03-16 0:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 0:54 [PATCH 0/3] git-completion.bash: improvements to _git_stash() Denton Liu
2021-03-16 0:54 ` Denton Liu [this message]
2021-03-16 0:54 ` [PATCH 2/3] git-completion.bash: fix `git <args>... stash branch` bug Denton Liu
2021-03-16 0:54 ` [PATCH 3/3] git-completion.bash: use __gitcomp_builtin() in _git_stash() Denton Liu
2021-03-18 9:46 ` [RESEND PATCH 0/3] git-completion.bash: improvements to _git_stash() Denton Liu
2021-03-18 9:46 ` [RESEND PATCH 1/3] git-completion.bash: extract from else in _git_stash() Denton Liu
2021-03-18 9:46 ` [RESEND PATCH 2/3] git-completion.bash: fix `git <args>... stash branch` bug Denton Liu
2021-03-18 20:30 ` Junio C Hamano
2021-03-19 8:05 ` Denton Liu
2021-03-19 15:53 ` Junio C Hamano
2021-03-18 9:46 ` [RESEND PATCH 3/3] git-completion.bash: use __gitcomp_builtin() in _git_stash() Denton Liu
2021-03-18 21:58 ` [RESEND PATCH 0/3] git-completion.bash: improvements to _git_stash() Junio C Hamano
2021-03-19 8:09 ` Denton Liu
2021-03-19 15:57 ` Junio C Hamano
2021-03-24 8:36 ` [PATCH v2 " Denton Liu
2021-03-24 8:36 ` [PATCH v2 1/3] git-completion.bash: pass $__git_subcommand_idx from __git_main() Denton Liu
2021-03-27 18:35 ` SZEDER Gábor
2021-03-28 10:31 ` SZEDER Gábor
2021-03-24 8:36 ` [PATCH v2 2/3] git-completion.bash: extract from else in _git_stash() Denton Liu
2021-03-28 10:30 ` SZEDER Gábor
2021-03-24 8:36 ` [PATCH v2 3/3] git-completion.bash: use __gitcomp_builtin() " Denton Liu
2021-03-28 11:04 ` SZEDER Gábor
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=a2d9bc4a6651ea5212ebf7a3ea5441bbd58c1aca.1615855962.git.liu.denton@gmail.com \
--to=liu.denton@gmail.com \
--cc=git@vger.kernel.org \
/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).