From 98fcdb0861af6462d233f6199568d64b01fb7b08 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 10 Mar 2016 23:15:51 +0000 Subject: 38128: _git: Fix completion of diffs against the index when treeish isn't shell-safe This affects 'git diff --cached -- ' and 'git reset $treeish '. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 63d8fd792..34be26e2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-03-10 Daniel Shahaf + * 38128: Completion/Unix/Command/_git: Fix completion of diffs + against the index when treeish isn't shell-safe + * 38123 (after 38074): Completion/Unix/Command/_git: _git reset $treeish: complete only staged files diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f0ad3d95d..6c88ad073 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 -- cgit 1.4.1