grep: support -h (no header) with --count
[gitweb.git] / t / lib-pack.sh
index fecd5a0279ca9df051c2aa53f8ff68d6a6b3359d..75098465716512a3373e64d51a5cdf848e9f1101 100644 (file)
@@ -1,5 +1,3 @@
-#!/bin/sh
-#
 # Support routines for hand-crafting weird or malicious packs.
 #
 # You can make a complete pack like:
 # Print the big-endian 4-byte octal representation of $1
 uint32_octal () {
        n=$1
-       printf '\%o' $(($n / 16777216)); n=$((n % 16777216))
-       printf '\%o' $(($n /    65536)); n=$((n %    65536))
-       printf '\%o' $(($n /      256)); n=$((n %      256))
-       printf '\%o' $(($n           ));
+       printf '\\%o' $(($n / 16777216)); n=$((n % 16777216))
+       printf '\\%o' $(($n /    65536)); n=$((n %    65536))
+       printf '\\%o' $(($n /      256)); n=$((n %      256))
+       printf '\\%o' $(($n           ));
 }
 
 # Print the big-endian 4-byte binary representation of $1
@@ -55,6 +53,28 @@ pack_obj () {
                        printf '\062\170\234\143\267\3\0\0\116\0\106'
                        return
                        ;;
+               01d7713666f4de822776c7622c10f1b07de280dc)
+                       printf '\165\1\327\161\66\146\364\336\202\47\166' &&
+                       printf '\307\142\54\20\361\260\175\342\200\334\170' &&
+                       printf '\234\143\142\142\142\267\003\0\0\151\0\114'
+                       return
+                       ;;
+               esac
+               ;;
+
+       # blob containing "\7\0"
+       01d7713666f4de822776c7622c10f1b07de280dc)
+               case "$2" in
+               '')
+                       printf '\062\170\234\143\147\0\0\0\20\0\10'
+                       return
+                       ;;
+               e68fe8129b546b101aee9510c5328e7f21ca1d18)
+                       printf '\165\346\217\350\22\233\124\153\20\32\356' &&
+                       printf '\225\20\305\62\216\177\41\312\35\30\170\234' &&
+                       printf '\143\142\142\142\147\0\0\0\53\0\16'
+                       return
+                       ;;
                esac
                ;;
        esac