This commit is contained in:
nuno maduro
2026-05-02 17:18:35 +01:00
parent 8a14056111
commit 1aa80dc398
3 changed files with 1 additions and 29 deletions

View File

@ -93,7 +93,6 @@
"test:inline": "php bin/pest --configuration=phpunit.inline.xml", "test:inline": "php bin/pest --configuration=phpunit.inline.xml",
"test:parallel": "php bin/pest --exclude-group=integration --parallel --processes=3", "test:parallel": "php bin/pest --exclude-group=integration --parallel --processes=3",
"test:integration": "php bin/pest --group=integration -v", "test:integration": "php bin/pest --group=integration -v",
"test:tia": "php bin/pest --configuration=tests-tia/phpunit.xml",
"update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --update-snapshots", "update:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --update-snapshots",
"test": [ "test": [
"@test:lint", "@test:lint",

View File

@ -657,8 +657,7 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
$changedFiles = new ChangedFiles($projectRoot); $changedFiles = new ChangedFiles($projectRoot);
$branchSha = $graph->recordedAtSha($this->branch); $branchSha = $graph->recordedAtSha($this->branch);
if ($changedFiles->gitAvailable() if ($branchSha !== null
&& $branchSha !== null
&& $changedFiles->since($branchSha) === null) { && $changedFiles->since($branchSha) === null) {
$this->renderBadge('WARN', 'Recorded commit is no longer reachable — graph will be rebuilt.'); $this->renderBadge('WARN', 'Recorded commit is no longer reachable — graph will be rebuilt.');
$graph = null; $graph = null;
@ -812,12 +811,6 @@ final class Tia implements AddsOutput, HandlesArguments, Terminable
{ {
$changedFiles = new ChangedFiles($projectRoot); $changedFiles = new ChangedFiles($projectRoot);
if (! $changedFiles->gitAvailable()) {
$this->renderBadge('WARN', 'Git unavailable — running full suite.');
return $arguments;
}
$branchSha = $graph->recordedAtSha($this->branch); $branchSha = $graph->recordedAtSha($this->branch);
$changed = $changedFiles->since($branchSha) ?? []; $changed = $changedFiles->since($branchSha) ?? [];

View File

@ -100,10 +100,6 @@ final readonly class ChangedFiles
*/ */
public function since(?string $sha): ?array public function since(?string $sha): ?array
{ {
if (! $this->gitAvailable()) {
return null;
}
$files = []; $files = [];
if ($sha !== null && $sha !== '') { if ($sha !== null && $sha !== '') {
@ -215,10 +211,6 @@ final readonly class ChangedFiles
public function currentBranch(): ?string public function currentBranch(): ?string
{ {
if (! $this->gitAvailable()) {
return null;
}
$process = new Process(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], $this->projectRoot); $process = new Process(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], $this->projectRoot);
$process->run(); $process->run();
@ -231,14 +223,6 @@ final readonly class ChangedFiles
return $branch === '' || $branch === 'HEAD' ? null : $branch; return $branch === '' || $branch === 'HEAD' ? null : $branch;
} }
public function gitAvailable(): bool
{
$process = new Process(['git', 'rev-parse', '--git-dir'], $this->projectRoot);
$process->run();
return $process->isSuccessful();
}
private function shaIsReachable(string $sha): bool private function shaIsReachable(string $sha): bool
{ {
$process = new Process( $process = new Process(
@ -322,10 +306,6 @@ final readonly class ChangedFiles
public function currentSha(): ?string public function currentSha(): ?string
{ {
if (! $this->gitAvailable()) {
return null;
}
$process = new Process(['git', 'rev-parse', 'HEAD'], $this->projectRoot); $process = new Process(['git', 'rev-parse', 'HEAD'], $this->projectRoot);
$process->run(); $process->run();