Skip to content

Commit db1e01e

Browse files
Fix git log parsing to split by NUL+newline
- Git log with --pretty=format adds newlines between commits - Split records by NUL+newline instead of double NUL - Fixes test failures where only 1 of 3 commits was being parsed Co-authored-by: Manuel Kießling <manuel@kiessling.net>
1 parent 0b55322 commit db1e01e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/WorkspaceMgmt/Infrastructure/Adapter/GitCliAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ public function getRecentCommits(string $workspacePath, int $limit = 10): array
255255
return [];
256256
}
257257

258-
// Split by double NUL (end of each commit record)
259-
$records = explode("\x00\x00", rtrim($output, "\x00"));
258+
// Split by NUL+newline (git log adds newlines between commits by default)
259+
$records = explode("\x00\n", rtrim($output, "\x00\n"));
260260
$commits = [];
261261

262262
foreach ($records as $record) {

0 commit comments

Comments
 (0)