All of lore.kernel.org
 help / color / mirror / Atom feed
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 1/4] completion: be nicer with zsh
Date: Thu, 2 Feb 2012 02:48:59 -0600	[thread overview]
Message-ID: <20120202084859.GC3823@burratino> (raw)
In-Reply-To: <1328145320-14071-1-git-send-email-felipe.contreras@gmail.com>

Hi,

Felipe Contreras wrote:

> Felipe Contreras (4):
>   completion: be nicer with zsh

Since I can't find this patch in the mail archive, I'll reply here.
Luckily the most important bit is above already.

I think I mentioned before that this subject line is what will appear
in the shortlog and the shortlog is all that some people will see of
the changelog, so it should include a self-contained description of
the impact of the patch.

However, clearly I did not say it clearly enough. :)  I guess it's
better to take a cue from storytellers and show rather than tell.
(Please don't take this as a precedent --- I will not always be doing
the style fixes myself, and sometimes will consider a patch to scratch
someone else's itch not worth the trouble and work on something else.)

-- >8 --
From: Felipe Contreras <felipe.contreras@gmail.com>
Date: Thu, 2 Feb 2012 03:15:17 +0200
Subject: completion: avoid default value assignment on : true command

zsh versions from 4.3.0 to present (4.3.15) do not correctly propagate
the SH_WORD_SPLIT option into the subshell in ${foo:=$(bar)}
expressions.  For example, after running

	emulate sh
	fn () {
		var='one two'
		printf '%s\n' $var
	}
	x=$(fn)
	: ${y=$(fn)}

printing "$x" results in two lines as expected, but printing "$y"
results in a single line because $var is expanded as a single word
when evaluating fn to compute y.

So avoid the construct, and use an explicit 'test -n "$foo" ||
foo=$(bar)' instead.  This fixes a bug tht caused all commands to be
treated as porcelain and show up in "git <TAB><TAB>" completion,
because the list of all commands was treated as a single word in
__git_list_porcelain_commands and did not match any of the patterns
that would usually cause plumbing to be excluded.

[jn: clarified commit message, indentation style fix]

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 contrib/completion/git-completion.bash |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 78be1958..d7965daf 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -676,7 +676,8 @@ __git_merge_strategies=
 # is needed.
 __git_compute_merge_strategies ()
 {
-	: ${__git_merge_strategies:=$(__git_list_merge_strategies)}
+	[ -n "$__git_merge_strategies" ] ||
+	__git_merge_strategies=$(__git_list_merge_strategies)
 }
 
 __git_complete_revlist_file ()
@@ -854,7 +855,8 @@ __git_list_all_commands ()
 __git_all_commands=
 __git_compute_all_commands ()
 {
-	: ${__git_all_commands:=$(__git_list_all_commands)}
+	[ -n "$__git_all_commands" ] ||
+	__git_all_commands=$(__git_list_all_commands)
 }
 
 __git_list_porcelain_commands ()
@@ -947,7 +949,8 @@ __git_porcelain_commands=
 __git_compute_porcelain_commands ()
 {
 	__git_compute_all_commands
-	: ${__git_porcelain_commands:=$(__git_list_porcelain_commands)}
+	[ -n "$__git_porcelain_commands" ] ||
+	__git_porcelain_commands=$(__git_list_porcelain_commands)
 }
 
 __git_pretty_aliases ()
-- 
1.7.9

  parent reply	other threads:[~2012-02-02  8:49 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 [this message]
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 ` [PATCH v3 2/4] completion: simplify __git_remotes Jonathan Nieder
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=20120202084859.GC3823@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.