summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-11-10 13:17:30 -0800
committerJunio C Hamano <gitster@pobox.com>2016-11-10 13:17:30 -0800
commit81cf0b6c7ea74cfe0e568e2d1a6709f8b3a777d4 (patch)
treec8c0b70c19f252dbce41087d30594c4c0e60154a
parentbe5a750939c212bc0781ffa04fabcfd2b2bd744e (diff)
parentec2e8b3da21c884325c9764abc62251fcfbe6208 (diff)
downloadgit-81cf0b6c7ea74cfe0e568e2d1a6709f8b3a777d4.tar.gz
Merge branch 'ls/filter-process'
Test portability improvements and optimization for an already-graduated topic. * ls/filter-process: t0021: compute file size with a single process instead of a pipeline t0021: expect more variations in the output of uniq -c
-rwxr-xr-xt/t0021-conversion.sh9
1 files changed, 4 insertions, 5 deletions
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index a20b9f58e3..cb72fa49de 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -22,7 +22,7 @@ generate_random_characters () {
}
file_size () {
- cat "$1" | wc -c | sed "s/^[ ]*//"
+ perl -e 'print -s $ARGV[0]' "$1"
}
filter_git () {
@@ -40,10 +40,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"
}