Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Restores set accessor

Author Dave Jarvis <email>
Date 2026-02-16 15:05:54 GMT-0800
Commit 65fe7aa8106025ebb470c3b5a0718aee4b1036a1
Parent ea17745
git/Git.php
public function __construct( string $repoPath ) {
+ $this->setRepository( $repoPath );
+ }
+
+ public function setRepository( string $repoPath ): void {
$this->repoPath = rtrim( $repoPath, '/' );
$this->objPath = $this->repoPath . '/objects';
git/GitPacks.php
if( $type === 6 ) {
$b = ord( fread( $handle, 1 ) );
-
- while( $b & 128 ) {
- $b = ord( fread( $handle, 1 ) );
- }
+ while( $b & 128 ) { $b = ord( fread( $handle, 1 ) ); }
} else {
fseek( $handle, 20, SEEK_CUR );
while( !feof( $handle ) && strlen( $head ) < 32 && $try < 64 ) {
$chunk = fread( $handle, 512 );
-
if( $chunk === '' ) { break; }
-
$out = @inflate_add( $infl, $chunk, ZLIB_NO_FLUSH );
-
if( $out !== false ) { $head .= $out; }
-
if( inflate_get_status( $infl ) === ZLIB_STREAM_END ) { break; }
-
$try++;
}
}
$pos = 0;
-
if( strlen( $head ) > 0 ) {
$this->readSize( $head, $pos );
return $this->readSize( $head, $pos );
}
-
return 0;
}
private function readSize( string $data, int &$pos ): int {
$len = strlen( $data );
-
while( $pos < $len && (ord( $data[$pos] ) & 128) ) { $pos++; }
-
$pos++;
$this->fileHandles[$path] = @fopen( $path, 'rb' );
}
-
return $this->fileHandles[$path];
}
git/GitRefs.php
if( is_dir( $dir ) ) {
$files = array_diff( scandir( $dir ), ['.', '..'] );
-
foreach( $files as $file ) {
$callback( $file, trim( file_get_contents( "$dir/$file" ) ) );
foreach( $paths as $ref ) {
$path = "{$this->repoPath}/$ref";
-
if( file_exists( $path ) ) {
$result = trim( file_get_contents( $path ) );
break;
}
}
if( $result === '' ) {
$packedPath = "{$this->repoPath}/packed-refs";
-
if( file_exists( $packedPath ) ) {
$result = $this->findInPackedRefs( $packedPath, $input );
if( $line[0] !== '#' && $line[0] !== '^' ) {
$parts = explode( ' ', trim( $line ) );
-
if( count( $parts ) >= 2 && in_array( $parts[1], $targets ) ) {
$result = $parts[0];
Delta 5 lines added, 18 lines removed, 13-line decrease