You are here

public static function Git::checkTracked in Drupal 10

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

Determines whether the specified scaffold file is tracked by git.

Parameters

\Composer\IO\IOInterface $io: The Composer IO interface.

string $path: Path to scaffold file to check.

string $dir: Base directory for git process.

Return value

bool Whether the specified file is already tracked or not (TRUE if tracked).

2 calls to Git::checkTracked()
GenerateAutoloadReferenceFile::autoloadFileCommitted in composer/Plugin/Scaffold/GenerateAutoloadReferenceFile.php
Determines whether or not the autoload file has been committed.
ManageGitIgnore::manageIgnored in composer/Plugin/Scaffold/ManageGitIgnore.php
Manages gitignore files.

File

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

Class

Git
Provide some Git utility operations.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

public static function checkTracked(IOInterface $io, $path, $dir = NULL) {
  $process = new ProcessExecutor($io);
  $output = '';
  $exitCode = $process
    ->execute('git ls-files --error-unmatch ' . $process
    ->escape($path), $output, $dir);
  return $exitCode == 0;
}