getUncommittedFiles method

Future<List<String>> getUncommittedFiles(
  1. String projectPath
)

Gets uncommitted file paths.

Implementation

Future<List<String>> getUncommittedFiles(String projectPath) async {
  final result = await _runner.run(
    'git',
    ['status', '--porcelain'],
    workingDirectory: projectPath,
  );
  if (result.exitCode != 0) return [];
  final raw = result.stdout.toString().trim();
  if (raw.isEmpty) return [];

  return raw
      .split('\n')
      .map((line) {
        if (line.length > 3) {
          return line.substring(3).trim();
        }
        return line.trim();
      })
      .where((e) => e.isNotEmpty)
      .toList();
}