fix git.branches: use pipe separator instead of null byte
test / unit + widget + golden + a11y (push) Failing after 35s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped

The null byte in the --format string didn't survive Process.run
argument passing, so the output was unparseable and no branches
were returned. Switched to pipe separator with lastIndexOf split
to handle branch names containing pipes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 00:59:42 +02:00
co-authored by Claude Opus 4.6
parent 8b6fdbd294
commit 80daa76623
+6 -4
View File
@@ -199,16 +199,18 @@ Future<List<({String name, bool current})>> gitBranches(
Directory workDir) async {
final r = await Process.run(
'git',
['branch', '--format=%(refname:short)\x00%(HEAD)'],
['branch', '--format=%(refname:short)|%(HEAD)'],
workingDirectory: workDir.path,
);
if (r.exitCode != 0) return const [];
final out = <({String name, bool current})>[];
for (final line in (r.stdout as String).split('\n')) {
if (line.trim().isEmpty) continue;
final parts = line.split('\x00');
if (parts.length < 2) continue;
out.add((name: parts[0], current: parts[1].trim() == '*'));
final sep = line.lastIndexOf('|');
if (sep < 0) continue;
final name = line.substring(0, sep);
final head = line.substring(sep + 1).trim();
out.add((name: name, current: head == '*'));
}
return out;
}