tagCreate method

Future<bool> tagCreate(
  1. String tag,
  2. String message, {
  3. String? commitId,
})

Create a tag, if it does not already exist.

Returns true if tag was successfully created.

Implementation

Future<bool> tagCreate(
  String tag,
  String message, {
  String? commitId,
}) async {
  if (await tagExists(
    tag,
  )) {
    return false;
  }

  final arguments = commitId != null && commitId.isNotEmpty
      ? ['tag', '-a', tag, commitId, '-m', message]
      : ['tag', '-a', tag, '-m', message];

  await executeCommand(
    arguments: arguments,
    throwOnExitCodeError: false,
  );

  return tagExists(
    tag,
  );
}