summaryrefslogtreecommitdiff
path: root/t/t9902-completion.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-09-26 17:51:06 -0400
committerJunio C Hamano <gitster@pobox.com>2012-09-27 17:25:52 -0700
commitbafed0dfb405b27e8b2b9680beece1dfaf5fdab2 (patch)
treed11775382dc80138070edf80d3a36c9a42d369f0 /t/t9902-completion.sh
parent49ba92b4eaca44ee4d7444b2256d60c2f32268ee (diff)
downloadgit-bafed0dfb405b27e8b2b9680beece1dfaf5fdab2.tar.gz
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>
Diffstat (limited to 't/t9902-completion.sh')
-rwxr-xr-xt/t9902-completion.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 2fc833ad8b..cbd0fb66f9 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -269,4 +269,23 @@ test_expect_success '<ref>: 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