public function getHeadSHA1() {
		$headFile = "{$this->dir}/HEAD";
		if ( !is_readable( $headFile ) ) {
			return false;
		}

		$head = file_get_contents( $headFile );
		if ( preg_match( "/ref: (.*)/", $head, $m ) ) {
			$head = rtrim( $m[1] );
		} else {
			$head = rtrim( $head );
		}

		if ( self::isSHA1( $head ) ) {
			// Detached head
			return $head;
		}

		// Resolve ref
		$refFile = "{$this->dir}/{$head}";
		if ( !is_readable( $refFile ) ) {
			return false;
		}

		return rtrim( file_get_contents( $refFile ) );
	}