You are here

public static function Git::isRepository in Drupal 9

Same name and namespace in other branches
  1. 8 composer/Plugin/Scaffold/Git.php \Drupal\Composer\Plugin\Scaffold\Git::isRepository()

Checks to see if the project root dir is in a git repository.

Parameters

string $dir: Base directory for git process.

Return value

bool True if this is a repository.

1 call to Git::isRepository()
ManageGitIgnore::managementOfGitIgnoreEnabled in composer/Plugin/Scaffold/ManageGitIgnore.php
Determines whether we should manage gitignore files.

File

composer/Plugin/Scaffold/Git.php, line 65

Class

Git
Provide some Git utility operations

Namespace

Drupal\Composer\Plugin\Scaffold

Code

public static function isRepository(IOInterface $io, $dir = NULL) {
  $process = new ProcessExecutor($io);
  $output = '';
  $exitCode = $process
    ->execute('git rev-parse --show-toplevel', $output, $dir);
  return $exitCode == 0;
}