Skip to content

Commit d747017

Browse files
committed
refactor: streamline base reference handling in version function
1 parent e1a4b44 commit d747017

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/version/version.dart

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ Future<VersionResult> version({
7777
cache: cache,
7878
);
7979

80-
final baseRefForPubspec = baseRef ??
81-
(packageName != null
82-
? await GitUtils.getPreviousRefForPackage(gitRoot.path, packageName, tagPrefix: 'v') ??
83-
(throw Exception('No previous version found for package $packageName'))
84-
: await GitUtils.getPreviousRef(gitRoot.path, tagPrefix: tagPrefix));
85-
8680
final pubspecPath =
8781
packageName != null ? join(relative(dartRoot.path, from: gitRoot.path), 'pubspec.yaml') : 'pubspec.yaml';
8882

@@ -91,7 +85,7 @@ Future<VersionResult> version({
9185
applyMagnitudeOverrides(changes, config);
9286

9387
final basePubSpec = await GitUtils.gitShow(
94-
baseRefForPubspec,
88+
effectiveBaseRef,
9589
gitRoot.path,
9690
pubspecPath,
9791
);
@@ -145,7 +139,7 @@ Future<VersionResult> version({
145139
}
146140

147141
if (badge) {
148-
final badgeContent = await generateVersionBadge(nextVersion);
142+
badgeContent = await generateVersionBadge(nextVersion);
149143
await File(join(dartRoot.path, 'version_badge.svg')).writeAsString(badgeContent);
150144
logger.info('Generated version badge for version $nextVersion');
151145
}

0 commit comments

Comments
 (0)