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 ) );
	}
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 ) );
	}
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 ) ) ; }
Return the SHA1 for the current HEAD of the Git repository.

@return string|bool A SHA1, or boolean false
Return the SHA1 for the current HEAD of the Git repository .