summaryrefslogtreecommitdiff
path: root/t/t0021-conversion.sh
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2016-11-03 20:12:13 (GMT)
committerJeff King <peff@peff.net>2016-11-08 20:26:40 (GMT)
commit038212c4c40c4cd9eb518fb1fbb5eb0d0d7d8f67 (patch)
treef733b3d9a7dbc0a4d91153742d1048d117981462 /t/t0021-conversion.sh
parent0f71fa273fc6c352a266894f1f757c5950230d9b (diff)
downloadgit-038212c4c40c4cd9eb518fb1fbb5eb0d0d7d8f67.zip
git-038212c4c40c4cd9eb518fb1fbb5eb0d0d7d8f67.tar.gz
git-038212c4c40c4cd9eb518fb1fbb5eb0d0d7d8f67.tar.bz2
t0021: expect more variations in the output of uniq -c
Some versions of uniq -c write the count left-justified, other version write it right-justified. Be prepared for both kinds. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 't/t0021-conversion.sh')
-rwxr-xr-xt/t0021-conversion.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index a20b9f5..db71aca 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -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"
}