From 70d82b966c2f62e7f7e6ad095709ecbe4726cce8 Mon Sep 17 00:00:00 2001 From: "Cy(rod) John" Date: Tue, 3 Nov 2026 23:56:08 +0800 Subject: [PATCH] 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"). --- src/Plugins/Tia/ChangedFiles.php | 2 +- tests/Features/Tia/WorktreeRename.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 tests/Features/Tia/WorktreeRename.php 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'); +});