grep: enable recurse-submodules to work on <tree> objects
[gitweb.git] / t / t0021-conversion.sh
index a8fa52148d479ba6d9e5b1078693e720dc05e5e0..4ea534e9fa70ea302d4a88a8bc922c100f896873 100755 (executable)
@@ -4,7 +4,7 @@ test_description='blob conversion via gitattributes'
 
 . ./test-lib.sh
 
-TEST_ROOT="$(pwd)"
+TEST_ROOT="$PWD"
 PATH=$TEST_ROOT:$PATH
 
 write_script <<\EOF "$TEST_ROOT/rot13.sh"
@@ -24,13 +24,12 @@ generate_random_characters () {
 }
 
 file_size () {
-       cat "$1" | wc -c | sed "s/^[ ]*//"
+       perl -e 'print -s $ARGV[0]' "$1"
 }
 
 filter_git () {
        rm -f rot13-filter.log &&
-       git "$@" 2>git-stderr.log &&
-       rm -f git-stderr.log
+       git "$@"
 }
 
 # Compare two files and ensure that `clean` and `smudge` respectively are
@@ -42,10 +41,9 @@ test_cmp_count () {
        actual=$2
        for FILE in "$expect" "$actual"
        do
-               sort "$FILE" | uniq -c | sed "s/^[ ]*//" |
-                       sed "s/^\([0-9]\) IN: clean/x IN: clean/" |
-                       sed "s/^\([0-9]\) IN: smudge/x IN: smudge/" >"$FILE.tmp" &&
-               mv "$FILE.tmp" "$FILE"
+               sort "$FILE" | uniq -c |
+               sed -e "s/^ *[0-9][0-9]*[       ]*IN: /x IN: /" >"$FILE.tmp" &&
+               mv "$FILE.tmp" "$FILE" || return
        done &&
        test_cmp "$expect" "$actual"
 }