Code

Merge branch 'ml/maint-grep-doc' into maint
[git.git] / t / test-lib.sh
index baa4093073564e081dcf6bc692910257663c9b03..a0e396a9522cec96443490fd77ff4abffb335287 100644 (file)
@@ -65,6 +65,8 @@ GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
 # CDPATH into the environment
 unset CDPATH
 
+unset GREP_OPTIONS
+
 case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
        1|2|true)
                echo "* warning: Some tests will not work if GIT_TRACE" \
@@ -230,6 +232,22 @@ test_decode_color () {
                -e 's/.\[m/<RESET>/g'
 }
 
+q_to_nul () {
+       perl -pe 'y/Q/\000/'
+}
+
+q_to_cr () {
+       tr Q '\015'
+}
+
+append_cr () {
+       sed -e 's/$/Q/' | tr Q '\015'
+}
+
+remove_cr () {
+       tr '\015' Q | sed -e 's/Q$//'
+}
+
 test_tick () {
        if test -z "${test_tick+set}"
        then