getCommitsBetween method Null safety

Future<List<String>> getCommitsBetween(
  1. String localCheckoutDirectory,
  2. String firstTag,
  3. String secondTag
)

Executes the git command

git rev-list oneTag anotherTag

in order to fetch all the commits done between two tags. In case of success, will return a list with a commit hash on each position, whereas in case of failure will return a list with one invalidGitCommandResult element.

Implementation

Future<List<String>> getCommitsBetween(
    String localCheckoutDirectory, String firstTag, String secondTag) async {
  String rawResult = "";

  try {
    ProcessResult processResult = await git_service.runGit(
        ['rev-list', '$firstTag...$secondTag'],
        echoOutput: true, processWorkingDir: localCheckoutDirectory);

    rawResult = processResult.stdout;
  } catch (e) {
    rawResult = invalidGitCommandResult;
  }

  return GitOutputParser.parseGitStdoutBasedOnNewLine(rawResult);
}