t0021: compute file size with a single process instead of a pipeline
authorJohannes Sixt <j6t@kdbg.org>
Sun, 6 Nov 2016 19:31:19 +0000 (20:31 +0100)
committerJeff King <peff@peff.net>
Tue, 8 Nov 2016 20:26:40 +0000 (15:26 -0500)
Avoid unwanted coding patterns (prodigal use of pipelines), and in
particular a useless use of cat.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jeff King <peff@peff.net>
t/t0021-conversion.sh
index db71acacb39121663b6dee03bcf13c46e0b11b24..cb72fa49deb1bc51acd53e01dc980fbb806c67bd 100755 (executable)
@@ -22,7 +22,7 @@ generate_random_characters () {
 }
 
 file_size () {
-       cat "$1" | wc -c | sed "s/^[ ]*//"
+       perl -e 'print -s $ARGV[0]' "$1"
 }
 
 filter_git () {