branchName function

Future<String> branchName(
  1. Directory testDir
)

Returns the name of the current branch in testDir

Implementation

Future<String> branchName(Directory testDir) async {
  final result = await Process.run('git', [
    'branch',
    '--show-current',
  ], workingDirectory: testDir.path);

  _throw('Could not get current branch name', result);

  return result.stdout.toString().trim();
}