mirror of
https://github.com/pestphp/pest.git
synced 2026-12-04 23:15:06 +01:00
1fbd63dbb3
* fix(tia): detect renames in both porcelain status columns
git status --porcelain emits worktree renames as " R new\0old". The parser only checked the first status column, so the paired source path was read as a standalone record and truncated by substr(3). The broken path then made git check-ignore exit 128, which surfaced as MissingDependency("Tia mode", "git").
* Fix worktree rename test style
---------
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
27 lines
733 B
PHP
27 lines
733 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Pest\Plugins\Tia\ChangedFiles;
|
|
use Tests\Fixtures\Tia\Project;
|
|
|
|
afterEach(function (): void {
|
|
Project::destroyAll();
|
|
});
|
|
|
|
test('a worktree rename recorded as intent-to-add keeps both paths', function (): void {
|
|
$project = Project::make('master');
|
|
|
|
$project->write('app/Stub.php', 'same content');
|
|
$project->git()->commit('add a file that will be moved');
|
|
|
|
$project->write('lib/Stub.php', 'same content');
|
|
$project->git()->run(['add', '-N', 'lib/Stub.php']);
|
|
unlink($project->path('app/Stub.php'));
|
|
|
|
$changed = new ChangedFiles($project->path())->since(null);
|
|
|
|
expect($changed)->toContain('app/Stub.php')
|
|
->and($changed)->toContain('lib/Stub.php');
|
|
});
|