showRef method

Future<List<CommitReference>> showRef({
  1. bool heads = false,
  2. bool tags = false,
})

Implementation

Future<List<CommitReference>> showRef({
  bool heads = false,
  bool tags = false,
}) async {
  final args = ['show-ref'];

  if (heads) {
    args.add('--heads');
  }

  if (tags) {
    args.add('--tags');
  }

  final pr = await runCommand(args, throwOnError: false);
  if (pr.exitCode == 1) {
    // no heads present, return empty collection
    return [];
  }

  // otherwise, it should have worked fine...
  assert(pr.exitCode == 0);

  return CommitReference.fromShowRefOutput(pr.stdout as String);
}