readLastFetchTime function
Read the mtime of .git/FETCH_HEAD.
Implementation
Future<DateTime?> readLastFetchTime(String cwd) async {
try {
// Find .git directory
final gitDir = await _findGitDir(cwd);
if (gitDir == null) return null;
final fetchHeadPath = p.join(gitDir, 'FETCH_HEAD');
try {
final stat = await File(fetchHeadPath).stat();
return stat.modified;
} catch (_) {
return null;
}
} catch (_) {
return null;
}
}