Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-02-09 04:26:37 +0400
committerJunio C Hamano <gitster@pobox.com>2014-02-10 23:49:53 +0400
commit16402b992e0332d2ac68106f4488b47175bf0a13 (patch)
tree1eedc82db674252cf0223b3882177631f2221336 /t/t0008-ignores.sh
parent3330a2c4f6b494f2b02fda2869d85bc1f8e019aa (diff)
dir: warn about trailing spaces in exclude patterns
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0008-ignores.sh')
-rwxr-xr-xt/t0008-ignores.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index b4d98e602f..9e1d64c6ac 100755
--- a/t/t0008-ignores.sh
+++ b/t/t0008-ignores.sh
@@ -775,4 +775,35 @@ test_expect_success PIPE 'streaming support for --stdin' '
echo "$response" | grep "^:: two"
'
+############################################################################
+#
+# test whitespace handling
+
+test_expect_success 'trailing whitespace is warned' '
+ mkdir whitespace &&
+ >whitespace/trailing &&
+ >whitespace/untracked &&
+ echo "whitespace/trailing " >ignore &&
+ cat >expect <<EOF &&
+whitespace/trailing
+whitespace/untracked
+EOF
+ git ls-files -o -X ignore whitespace >actual 2>err &&
+ grep "ignore:.*'\''whitespace/trailing '\''" err &&
+ test_cmp expect actual
+'
+
+test_expect_success 'quoting allows trailing whitespace' '
+ rm -rf whitespace &&
+ mkdir whitespace &&
+ >"whitespace/trailing " &&
+ >whitespace/untracked &&
+ echo "whitespace/trailing\\ \\ " >ignore &&
+ echo whitespace/untracked >expect &&
+ : >err.expect &&
+ git ls-files -o -X ignore whitespace >actual 2>err &&
+ test_cmp expect actual &&
+ test_cmp err.expect err
+'
+
test_done