Skip to content

Commit

Permalink
t9902: add completion tests for "odd" filenames
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Sep 28, 2012
1 parent 49ba92b commit bafed0d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions t/t9902-completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bafed0d

Please sign in to comment.