From: Jeff King Date: Wed, 26 Sep 2012 21:51:06 +0000 (-0400) Subject: t9902: add completion tests for "odd" filenames X-Git-Tag: v1.8.0-rc0~1^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bafed0dfb405b27e8b2b9680beece1dfaf5fdab2;p=git.git t9902: add completion tests for "odd" filenames We correctly handle completion items with spaces just fine, since we pass the lists around with newline delimiters. However, we do not handle filenames with shell metacharacters, as "compgen -W" performs expansion on the list we give it. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 2fc833ad8..cbd0fb66f 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -269,4 +269,23 @@ test_expect_success ': completes paths' ' EOF ' +test_expect_success 'complete tree filename with spaces' ' + echo content >"name with spaces" && + git add . && + git commit -m spaces && + test_completion_long "git show HEAD:nam" <<-\EOF + name with spaces_ + EOF +' + +test_expect_failure 'complete tree filename with metacharacters' ' + echo content >"name with \${meta}" && + git add . && + git commit -m meta && + test_completion_long "git show HEAD:nam" <<-\EOF + name with ${meta}_ + name with spaces_ + EOF +' + test_done