Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git
git/Git.php
yield $head;
- if( !empty( $objs ) ) {
- foreach( $objs as $sha => $type ) {
- $cont = $this->read( $sha );
- $size = strlen( $cont );
- $byte = $type << 4 | $size & 0x0f;
- $size >>= 4;
- $data = '';
+ foreach( $objs as $sha => $type ) {
+ $cont = '';
+ $size = $this->getObjectSize( $sha );
- while( $size > 0 ) {
- $data .= chr( $byte | 0x80 );
- $byte = $size & 0x7f;
- $size >>= 7;
- }
+ $this->slurp( $sha, function( $chunk ) use ( &$cont ) {
+ $cont .= $chunk;
+ } );
- $data .= chr( $byte ) . gzcompress( $cont );
+ $byte = $type << 4 | $size & 0x0f;
+ $size >>= 4;
+ $data = '';
- hash_update( $ctx, $data );
- yield $data;
+ while( $size > 0 ) {
+ $data .= chr( $byte | 0x80 );
+ $byte = $size & 0x7f;
+ $size >>= 7;
}
+
+ $data .= chr( $byte ) . gzcompress( $cont );
+
+ hash_update( $ctx, $data );
+ yield $data;
}

Bypasses MAX_READ limits to chunk large files

Author Dave Jarvis <email>
Date 2026-02-20 01:40:09 GMT-0800
Commit 84776476d64af50b4410ab3f1d2287601a42525f
Parent 7ab9db3
Delta 18 lines added, 15 lines removed, 3-line increase