From: Jonathan Nieder <jrnieder@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>,
"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH v3 2/4] completion: simplify __git_remotes
Date: Thu, 2 Feb 2012 03:05:29 -0600 [thread overview]
Message-ID: <20120202090529.GD3823@burratino> (raw)
In-Reply-To: <1328145320-14071-1-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras wrote:
> completion: simplify __git_remotes
> completion: remove unused code
In the same spirit of stealing potential shortlog lines from Junio:
-- >8 --
From: Felipe Contreras <felipe.contreras@gmail.com>
Subject: completion: use ls -1 instead of rolling a loop to do that ourselves
This simplifies the code a great deal. In particular, it allows us to
get rid of __git_shopt, which is used only in this fuction to enable
'nullglob' in zsh.
[jn: squashed with a patch that actually gets rid of __git_shopt]
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
The diffstat says it all.
contrib/completion/git-completion.bash | 37 +-------------------------------
1 files changed, 1 insertions(+), 36 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 78be1958..4612dde9 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -644,12 +644,7 @@ __git_refs_remotes ()
__git_remotes ()
{
local i ngoff IFS=$'\n' d="$(__gitdir)"
- __git_shopt -q nullglob || ngoff=1
- __git_shopt -s nullglob
- for i in "$d/remotes"/*; do
- echo ${i#$d/remotes/}
- done
- [ "$ngoff" ] && __git_shopt -u nullglob
+ test -d "$d/remotes" && ls -1 "$d/remotes"
for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do
i="${i#remote.}"
echo "${i/.url*/}"
@@ -2733,33 +2728,3 @@ if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \
|| complete -o default -o nospace -F _git git.exe
fi
-
-if [[ -n ${ZSH_VERSION-} ]]; then
- __git_shopt () {
- local option
- if [ $# -ne 2 ]; then
- echo "USAGE: $0 (-q|-s|-u) <option>" >&2
- return 1
- fi
- case "$2" in
- nullglob)
- option="$2"
- ;;
- *)
- echo "$0: invalid option: $2" >&2
- return 1
- esac
- case "$1" in
- -q) setopt | grep -q "$option" ;;
- -u) unsetopt "$option" ;;
- -s) setopt "$option" ;;
- *)
- echo "$0: invalid flag: $1" >&2
- return 1
- esac
- }
-else
- __git_shopt () {
- shopt "$@"
- }
-fi
--
1.7.9
next prev parent reply other threads:[~2012-02-02 9:06 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 1:15 [PATCH v3 0/4] completion: couple of cleanups Felipe Contreras
[not found] ` <1328145320-14071-2-git-send-email-felipe.contreras@gmail.com>
2012-02-02 8:16 ` [PATCH v3 1/4] completion: be nicer with zsh Jonathan Nieder
2012-02-02 8:34 ` Felipe Contreras
2012-02-02 9:10 ` Jonathan Nieder
2012-02-02 9:38 ` Felipe Contreras
2012-02-02 9:46 ` Jonathan Nieder
2012-02-02 10:18 ` Felipe Contreras
2012-02-02 8:48 ` Jonathan Nieder
2012-02-02 10:12 ` Felipe Contreras
2012-02-02 10:35 ` Thomas Rast
2012-02-02 10:50 ` Jonathan Nieder
2012-02-02 10:55 ` Jonathan Nieder
2012-02-02 11:00 ` Felipe Contreras
2012-02-02 19:27 ` Junio C Hamano
2012-02-02 20:45 ` Felipe Contreras
2012-02-03 0:17 ` Junio C Hamano
2012-02-03 10:38 ` Felipe Contreras
2012-02-03 20:28 ` Junio C Hamano
2012-02-04 15:46 ` Felipe Contreras
2012-02-04 18:26 ` [bug] blame duplicates trailing ">" in mailmapped emails Jeff King
2012-02-04 19:30 ` Felipe Contreras
2012-02-04 23:20 ` Jeff King
2012-02-05 21:11 ` Felipe Contreras
2012-02-05 23:50 ` Jeff King
2012-02-05 20:16 ` Junio C Hamano
2012-02-05 21:38 ` Junio C Hamano
2012-02-05 23:47 ` Jeff King
2012-02-06 0:39 ` Junio C Hamano
2012-02-06 3:03 ` Jeff King
2012-02-06 3:13 ` Junio C Hamano
2012-02-06 3:16 ` Junio C Hamano
2012-02-06 4:01 ` Jeff King
2012-02-06 12:14 ` Felipe Contreras
2012-02-06 22:04 ` Junio C Hamano
2012-02-06 23:11 ` Felipe Contreras
2012-02-05 20:49 ` [PATCH v3 1/4] completion: be nicer with zsh Junio C Hamano
2012-02-02 9:05 ` Jonathan Nieder [this message]
2012-02-02 19:48 ` [PATCH v3 0/4] completion: couple of cleanups Junio C Hamano
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=20120202090529.GD3823@burratino \
--to=jrnieder@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder@ira.uka.de \
/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).