]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/lib-pack.sh
index-pack: check .gitmodules files with --strict
[thirdparty/git.git] / t / lib-pack.sh
index 75098465716512a3373e64d51a5cdf848e9f1101..4674899b30871f55894750b61b66020f0d16a646 100644 (file)
@@ -79,6 +79,18 @@ pack_obj () {
                ;;
        esac
 
+       # If it's not a delta, we can convince pack-objects to generate a pack
+       # with just our entry, and then strip off the header (12 bytes) and
+       # trailer (20 bytes).
+       if test -z "$2"
+       then
+               echo "$1" | git pack-objects --stdout >pack_obj.tmp &&
+               size=$(wc -c <pack_obj.tmp) &&
+               dd if=pack_obj.tmp bs=1 count=$((size - 20 - 12)) skip=12 &&
+               rm -f pack_obj.tmp
+               return
+       fi
+
        echo >&2 "BUG: don't know how to print $1${2:+ (from $2)}"
        return 1
 }