diff --git a/src/Plugins/Tia/ChangedFiles.php b/src/Plugins/Tia/ChangedFiles.php index 4c2e446b7..25efe8b04 100644 --- a/src/Plugins/Tia/ChangedFiles.php +++ b/src/Plugins/Tia/ChangedFiles.php @@ -359,7 +359,7 @@ private function workingTreeChanges(): array $status = substr($record, 0, 2); $path = substr($record, 3); - if ($status[0] === 'R' || $status[0] === 'C') { + if (str_contains($status, 'R') || str_contains($status, 'C')) { $files[] = $path; if (isset($records[$i + 1]) && $records[$i + 1] !== '') { diff --git a/tests/Features/Tia/WorktreeRename.php b/tests/Features/Tia/WorktreeRename.php new file mode 100644 index 000000000..521ae9145 --- /dev/null +++ b/tests/Features/Tia/WorktreeRename.php @@ -0,0 +1,26 @@ +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'); +});