Merge branch 'jk/rev-parse-cleanup'
[gitweb.git] / t / t0003-attributes.sh
index f0fbb425545019a6275a347a5826f6ba2977d394..f19ae4f8ccddacee84e04fa50663672f5f6174c1 100755 (executable)
@@ -13,10 +13,31 @@ attr_check () {
        test_line_count = 0 err
 }
 
+attr_check_quote () {
+
+       path="$1"
+       quoted_path="$2"
+       expect="$3"
+
+       git check-attr test -- "$path" >actual &&
+       echo "\"$quoted_path\": test: $expect" >expect &&
+       test_cmp expect actual
+
+}
+
+test_expect_success 'open-quoted pathname' '
+       echo "\"a test=a" >.gitattributes &&
+       test_must_fail attr_check a a
+'
+
+
 test_expect_success 'setup' '
        mkdir -p a/b/d a/c b &&
        (
                echo "[attr]notest !test"
+               echo "\" d \"   test=d"
+               echo " e        test=e"
+               echo " e\"      test=e"
                echo "f test=f"
                echo "a/i test=a/i"
                echo "onoff test -test"
@@ -69,6 +90,11 @@ test_expect_success 'command line checks' '
 '
 
 test_expect_success 'attribute test' '
+
+       attr_check " d " d &&
+       attr_check e e &&
+       attr_check_quote e\" e\\\" e &&
+
        attr_check f f &&
        attr_check a/f f &&
        attr_check a/c/f f &&