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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Sep 26, 2012 at 17:51 UTC bafed0dfb405b27e8b2b9680beece1dfaf5fdab2
1 file changed +19
t/t9902-completion.sh
+19
@@ -269,4 +269,23 @@ test_expect_success '<ref>: completes paths' '
269 EOF
270 '
271
272 +test_expect_success 'complete tree filename with spaces' '
273 + echo content >"name with spaces" &&
274 + git add . &&
275 + git commit -m spaces &&
276 + test_completion_long "git show HEAD:nam" <<-\EOF
277 + name with spaces_
278 + EOF
279 +'
280 +
281 +test_expect_failure 'complete tree filename with metacharacters' '
282 + echo content >"name with \${meta}" &&
283 + git add . &&
284 + git commit -m meta &&
285 + test_completion_long "git show HEAD:nam" <<-\EOF
286 + name with ${meta}_
287 + name with spaces_
288 + EOF
289 +'
290 +
291 test_done