ident: use a dynamic strbuf in fmt_ident
[gitweb.git] / t / t0021-conversion.sh
index 275421e48ecde787bafba8437ef5977fd153a0e2..e50f0f742fdc4dca766e3f236cd32e388f0c89aa 100755 (executable)
@@ -66,10 +66,14 @@ test_expect_success expanded_in_repo '
                echo "\$Id:NoSpaceAtEitherEnd\$"
                echo "\$Id: NoTerminatingSymbol"
                echo "\$Id: Foreign Commit With Spaces \$"
-               printf "\$Id: NoTerminatingSymbolAtEOF"
-       } > expanded-keywords &&
+       } >expanded-keywords.0 &&
 
-       git add expanded-keywords &&
+       {
+               cat expanded-keywords.0 &&
+               printf "\$Id: NoTerminatingSymbolAtEOF"
+       } >expanded-keywords &&
+       cat expanded-keywords >expanded-keywords-crlf &&
+       git add expanded-keywords expanded-keywords-crlf &&
        git commit -m "File with keywords expanded" &&
        id=$(git rev-parse --verify :expanded-keywords) &&
 
@@ -83,15 +87,27 @@ test_expect_success expanded_in_repo '
                echo "\$Id: $id \$"
                echo "\$Id: NoTerminatingSymbol"
                echo "\$Id: Foreign Commit With Spaces \$"
+       } >expected-output.0 &&
+       {
+               cat expected-output.0 &&
+               printf "\$Id: NoTerminatingSymbolAtEOF"
+       } >expected-output &&
+       {
+               append_cr <expected-output.0 &&
                printf "\$Id: NoTerminatingSymbolAtEOF"
-       } > expected-output &&
+       } >expected-output-crlf &&
+       {
+               echo "expanded-keywords ident"
+               echo "expanded-keywords-crlf ident text eol=crlf"
+       } >>.gitattributes &&
 
-       echo "expanded-keywords ident" >> .gitattributes &&
+       rm -f expanded-keywords expanded-keywords-crlf &&
 
-       rm -f expanded-keywords &&
        git checkout -- expanded-keywords &&
-       cat expanded-keywords &&
-       cmp expanded-keywords expected-output
+       test_cmp expanded-keywords expected-output &&
+
+       git checkout -- expanded-keywords-crlf &&
+       test_cmp expanded-keywords-crlf expected-output-crlf
 '
 
 # The use of %f in a filter definition is expanded to the path to
@@ -137,4 +153,41 @@ test_expect_success 'filter shell-escaped filenames' '
        :
 '
 
+test_expect_success 'required filter success' '
+       git config filter.required.smudge cat &&
+       git config filter.required.clean cat &&
+       git config filter.required.required true &&
+
+       echo "*.r filter=required" >.gitattributes &&
+
+       echo test >test.r &&
+       git add test.r &&
+       rm -f test.r &&
+       git checkout -- test.r
+'
+
+test_expect_success 'required filter smudge failure' '
+       git config filter.failsmudge.smudge false &&
+       git config filter.failsmudge.clean cat &&
+       git config filter.failsmudge.required true &&
+
+       echo "*.fs filter=failsmudge" >.gitattributes &&
+
+       echo test >test.fs &&
+       git add test.fs &&
+       rm -f test.fs &&
+       test_must_fail git checkout -- test.fs
+'
+
+test_expect_success 'required filter clean failure' '
+       git config filter.failclean.smudge cat &&
+       git config filter.failclean.clean false &&
+       git config filter.failclean.required true &&
+
+       echo "*.fc filter=failclean" >.gitattributes &&
+
+       echo test >test.fc &&
+       test_must_fail git add test.fc
+'
+
 test_done