From: Jonathan Nieder <jrnieder@gmail.com>
To: Felipe Contreras <felipec@infradead.org>
Cc: git@vger.kernel.org,
"Felipe Contreras" <felipe.contreras@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"Shawn O. Pearce" <spearce@spearce.org>,
"SZEDER Gábor" <szeder@ira.uka.de>
Subject: Re: [PATCH v2 1/4] completion: simplify __git_remotes
Date: Mon, 30 Jan 2012 11:34:46 -0600 [thread overview]
Message-ID: <20120130173446.GF10618@burratino> (raw)
In-Reply-To: <1327944197-6379-2-git-send-email-felipec@infradead.org>
Felipe Contreras wrote:
> From: Felipe Contreras <felipe.contreras@gmail.com>
>
> There's no need for all that complicated code that requires nullglob,
> and the complexities related to such option.
>
> As an advantage, this would allow us to get rid of __git_shopt, which is
> used only in this fuction to enable 'nullglob' in zsh.
That is all a longwinded way to say "zsh doesn't support the same
interface as bash for setting the nullglob option, so let's avoid
it and use 'ls' which is simpler", right?
There's a potential speed regression involved --- using "ls" involves
an extra fork/exec. I believe you have thought about this and done a
little to mitigate it; could you explain this in the commit message so
future coders know what features of your code need to be preserved?
Please consider squashing this with patch 2/4. It will make both
patches way easier to understand on their own.
Cc-ing Gábor, who I imagine is more familiar with this code than I am.
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
> contrib/completion/git-completion.bash | 7 +------
> 1 files changed, 1 insertions(+), 6 deletions(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 1496c6d..086e38d 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*/}"
> --
> 1.7.8
>
next prev parent reply other threads:[~2012-01-30 17:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 17:23 [PATCH 0/4] completion: trivial cleanups Felipe Contreras
2012-01-30 17:23 ` [PATCH v2 2/4] completion: remove unused code Felipe Contreras
[not found] ` <1327944197-6379-2-git-send-email-felipec@infradead.org>
2012-01-30 17:34 ` Jonathan Nieder [this message]
2012-01-30 18:27 ` [PATCH v2 1/4] completion: simplify __git_remotes Junio C Hamano
[not found] ` <1327944197-6379-4-git-send-email-felipec@infradead.org>
2012-01-30 17:50 ` [PATCH v2 3/4] completion: cleanup __gitcomp* Jonathan Nieder
2012-01-30 19:03 ` Junio C Hamano
2012-01-30 21:25 ` Junio C Hamano
2012-01-31 0:15 ` SZEDER Gábor
2012-01-31 0:25 ` Jonathan Nieder
[not found] ` <1327944197-6379-5-git-send-email-felipec@infradead.org>
2012-01-30 17:53 ` [PATCH v2 4/4] completion: be nicer with zsh Jonathan Nieder
2012-01-30 18:10 ` Felipe Contreras
2012-01-30 18:25 ` Jonathan Nieder
2012-01-30 18:56 ` Felipe Contreras
2012-01-30 19:03 ` Jonathan Nieder
2012-01-30 19:09 ` Junio C Hamano
2012-01-30 19:22 ` Felipe Contreras
2012-01-30 19:28 ` Jonathan Nieder
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=20120130173446.GF10618@burratino \
--to=jrnieder@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=felipec@infradead.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=spearce@spearce.org \
--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).