sha1 method

Future<String?> sha1(
  1. String revision
)

full Sha1 or null

Implementation

Future<String?> sha1(String revision) async {
  final hash = await _git('rev-parse $revision', emptyResultIsError: false);
  if (hash == null) {
    return null;
  }
  assert(
    () {
      if (hash.isEmpty) throw ArgumentError("sha1 is empty ''");
      if (hash.split('\n').length != 1) throw ArgumentError("sha1 is multiline '$hash'");
      return true;
    }(),
  );

  return hash;
}