src/Foundation/Console/InfoCommand.php
private function findPackageVersion($path, $fallback = null)
    {
        if (file_exists("$path/.git")) {
            $cwd = getcwd();
            chdir($path);

            $output = [];
            $status = null;
            exec('git rev-parse HEAD 2>&1', $output, $status);

            chdir($cwd);

            if ($status == 0) {
                return isset($fallback) ? "$fallback ($output[0])" : $output[0];
            }
        }

        return $fallback;
    }
private function findPackageVersion($path, $fallback = null)
    {
        if (file_exists("$path/.git")) {
            $cwd = getcwd();
            chdir($path);

            $output = [];
            $status = null;
            exec('git rev-parse HEAD 2>&1', $output, $status);

            chdir($cwd);

            if ($status == 0) {
                return isset($fallback) ? "$fallback ($output[0])" : $output[0];
            }
        }

        return $fallback;
    }
private function findPackageVersion ( $ path , $ fallback = null ) { if ( file_exists ( "$path/.git" ) ) { $ cwd = getcwd ( ) ; chdir ( $ path ) ; $ output = [ ] ; $ status = null ; exec ( 'git rev-parse HEAD 2>&1' , $ output , $ status ) ; chdir ( $ cwd ) ; if ( $ status == 0 ) { return isset ( $ fallback ) ? "$fallback ($output[0])" : $ output [ 0 ] ; } } return $ fallback ; }
Try to detect a package's exact version.

If the package seems to be a Git version, we extract the currently
checked out commit using the command line.

@param string $path
@param string $fallback
@return string
Try to detect a package s exact version .