Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Git.php

function Git::getVersion

Retrieves the current git version.

Return value

string|null The git version number, if present.

3 calls to Git::getVersion()
DiagnoseCommand::checkGit in vendor/composer/composer/src/Composer/Command/DiagnoseCommand.php
Git::getNoShowSignatureFlag in vendor/composer/composer/src/Composer/Util/Git.php
GitDownloader::doDownload in vendor/composer/composer/src/Composer/Downloader/GitDownloader.php
@inheritDoc

File

vendor/composer/composer/src/Composer/Util/Git.php, line 595

Class

Git
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Util

Code

public static function getVersion(ProcessExecutor $process) : ?string {
    if (false === self::$version) {
        self::$version = null;
        if (0 === $process->execute([
            'git',
            '--version',
        ], $output) && Preg::isMatch('/^git version (\\d+(?:\\.\\d+)+)/m', $output, $matches)) {
            self::$version = $matches[1];
        }
    }
    return self::$version;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal