From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6363 invoked by alias); 10 Mar 2016 23:16:06 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 38128 Received: (qmail 6237 invoked from network); 10 Mar 2016 23:16:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] _git: Fix completion of diffs against the index when treeish isn't shell-safe Date: Thu, 10 Mar 2016 23:15:51 +0000 Message-Id: <1457651751-5176-1-git-send-email-danielsh@tarsus.local2> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <20160309233318.GA27898@tarsus.local2> References: <20160309233318.GA27898@tarsus.local2> This affects 'git diff --cached -- ' and 'git reset $treeish '. --- To be applied on top of the last patch. Completion/Unix/Command/_git | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f0ad3d9..6c88ad0 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6077,7 +6077,8 @@ __git_diff-index_files () { local tree=$1 description=$2 tag=$3; shift 3 local files expl - files=$(_call_program files git diff-index -z --name-only --no-color --cached $tree 2>/dev/null) + # $tree needs to be escaped for _call_program; matters for $tree = "HEAD^" + files=$(_call_program files git diff-index -z --name-only --no-color --cached ${(q)tree} 2>/dev/null) __git_command_successful $pipestatus || return 1 files=(${(0)"$(__git_files_relative $files)"}) __git_command_successful $pipestatus || return 1