Future<void> writeIndex(GitIndex index) async { var path = p.join(gitDir, 'index.new'); var file = fs.file(path); await file.writeAsBytes(index.serialize()); await file.rename(p.join(gitDir, 'index')); }