+ public function testReadingHead() {
+ $dir = __DIR__ . '/../data/gitrepo/1';
+ $fixture = new GitInfo( $dir );
+
+ $this->assertEquals( 'refs/heads/master', $fixture->getHead() );
+ $this->assertEquals( '0123456789012345678901234567890123abcdef', $fixture->getHeadSHA1() );
+ }
+
+ public function testIndirection() {
+ $dir = __DIR__ . '/../data/gitrepo/2';
+ $fixture = new GitInfo( $dir );
+
+ $this->assertEquals( 'refs/heads/master', $fixture->getHead() );
+ $this->assertEquals( '0123456789012345678901234567890123abcdef', $fixture->getHeadSHA1() );
+ }
+
+ public function testIndirection2() {
+ $dir = __DIR__ . '/../data/gitrepo/3';
+ $fixture = new GitInfo( $dir );
+
+ $this->assertEquals( 'refs/heads/master', $fixture->getHead() );
+ $this->assertEquals( '0123456789012345678901234567890123abcdef', $fixture->getHeadSHA1() );
+ }
+
+ public function testReadingPackedRefs() {
+ $dir = __DIR__ . '/../data/gitrepo/1';
+ unlink( __DIR__ . '/../data/gitrepo/1/.git/refs/heads/master' );
+ $fixture = new GitInfo( $dir );
+
+ $this->assertEquals( 'refs/heads/master', $fixture->getHead() );
+ $this->assertEquals( 'abcdef6789012345678901234567890123456789', $fixture->getHeadSHA1() );
+ }