append_cr(), remove_cr(), q_to_nul() and q_to_cr() are defined in multiple
tests. Consolidate them into test-lib.sh so we can stop redefining them.
The use of remove_cr() in t0020 to test for a CR is replaced with a new
function has_cr() to accurately reflect what is intended (the output of
remove_cr() was being thrown away).
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Stephen Boyd15 years agocommitted byJunio C Hamano
@ -285,7 +272,7 @@ test_expect_success '.gitattributes says two is binary' '
@@ -285,7 +272,7 @@ test_expect_success '.gitattributes says two is binary' '
git config core.autocrlf true &&
git read-tree --reset -u HEAD &&
if remove_cr dir/two >/dev/null
if has_cr dir/two
then
echo "Huh?"
false
@ -293,7 +280,7 @@ test_expect_success '.gitattributes says two is binary' '
@@ -293,7 +280,7 @@ test_expect_success '.gitattributes says two is binary' '
: happy
fi &&
if remove_cr one >/dev/null
if has_cr one
then
: happy
else
@ -301,7 +288,7 @@ test_expect_success '.gitattributes says two is binary' '
@@ -301,7 +288,7 @@ test_expect_success '.gitattributes says two is binary' '
false
fi &&
if remove_cr three >/dev/null
if has_cr three
then
echo "Huh?"
false
@ -316,7 +303,7 @@ test_expect_success '.gitattributes says two is input' '
@@ -316,7 +303,7 @@ test_expect_success '.gitattributes says two is input' '
echo "two crlf=input" >.gitattributes &&
git read-tree --reset -u HEAD &&
if remove_cr dir/two >/dev/null
if has_cr dir/two
then
echo "Huh?"
false
@ -331,7 +318,7 @@ test_expect_success '.gitattributes says two and three are text' '
@@ -331,7 +318,7 @@ test_expect_success '.gitattributes says two and three are text' '
echo "t* crlf" >.gitattributes &&
git read-tree --reset -u HEAD &&
if remove_cr dir/two >/dev/null
if has_cr dir/two
then
: happy
else
@ -339,7 +326,7 @@ test_expect_success '.gitattributes says two and three are text' '
@@ -339,7 +326,7 @@ test_expect_success '.gitattributes says two and three are text' '