fetchGitDiffHunks function
Fetch git diff hunks on-demand.
Implementation
Future<Map<String, List<StructuredPatchHunk>>> fetchGitDiffHunks({
String? cwd,
}) async {
if (!await getIsGit(cwd: cwd)) return {};
if (await _isInTransientGitState(cwd: cwd)) return {};
final result = await _runGit([
'--no-optional-locks',
'diff',
'HEAD',
], cwd: cwd);
if (result.code != 0) return {};
return parseGitDiff(result.stdout);
}