From da03c6ca401fb32f398d6fd4acbe0774cdf3efc5 Mon Sep 17 00:00:00 2001 From: Sigurd Meldgaard Date: Mon, 12 Feb 2024 11:12:49 +0000 Subject: [PATCH] Rename GitResolvedDescription to ResolvedGitDescription --- lib/src/command/dependency_services.dart | 2 +- lib/src/source/git.dart | 22 +++++++++++----------- test/get/git/ssh_url_test.dart | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/src/command/dependency_services.dart b/lib/src/command/dependency_services.dart index c16e8501ec..124cae186e 100644 --- a/lib/src/command/dependency_services.dart +++ b/lib/src/command/dependency_services.dart @@ -235,7 +235,7 @@ class DependencyServicesListCommand extends PubCommand { extension on PackageId { String versionOrHash() { final description = this.description; - if (description is GitResolvedDescription) { + if (description is ResolvedGitDescription) { return description.resolvedRef; } else { return version.toString(); diff --git a/lib/src/source/git.dart b/lib/src/source/git.dart index 04cda014c9..8e0396cec1 100644 --- a/lib/src/source/git.dart +++ b/lib/src/source/git.dart @@ -113,7 +113,7 @@ class GitSource extends CachedSource { return PackageId( name, version, - GitResolvedDescription( + ResolvedGitDescription( GitDescription( url: url, ref: ref, @@ -229,7 +229,7 @@ class GitSource extends CachedSource { await _ensureRepoCache(description, cache); var path = _repoCachePath(description, cache); var revision = await _firstRevision(path, description.ref); - final resolvedDescription = GitResolvedDescription(description, revision); + final resolvedDescription = ResolvedGitDescription(description, revision); return Pubspec.parse( await _showFileAtRevision(resolvedDescription, 'pubspec.yaml', cache), @@ -243,7 +243,7 @@ class GitSource extends CachedSource { /// Assumes that revision is present in the cache already (can be done with /// [_ensureRevision]). Future _showFileAtRevision( - GitResolvedDescription resolvedDescription, + ResolvedGitDescription resolvedDescription, String pathInProject, SystemCache cache, ) async { @@ -292,7 +292,7 @@ class GitSource extends CachedSource { PackageId( ref.name, pubspec.version, - GitResolvedDescription(description, revision), + ResolvedGitDescription(description, revision), ), ]; }); @@ -303,7 +303,7 @@ class GitSource extends CachedSource { @override Future describeUncached(PackageId id, SystemCache cache) { final description = id.description; - if (description is! GitResolvedDescription) { + if (description is! ResolvedGitDescription) { throw StateError('Called with wrong ref'); } return _pool.withResource( @@ -330,7 +330,7 @@ class GitSource extends CachedSource { return Pubspec.parse( await _showFileAtRevision( - GitResolvedDescription(description, revision), + ResolvedGitDescription(description, revision), 'pubspec.yaml', cache, ), @@ -370,7 +370,7 @@ class GitSource extends CachedSource { ensureDir(p.join(cache.rootDirForSource(this), 'cache')); final resolvedRef = - (id.description as GitResolvedDescription).resolvedRef; + (id.description as ResolvedGitDescription).resolvedRef; didUpdate |= await _ensureRevision(description, resolvedRef, cache); @@ -702,7 +702,7 @@ class GitSource extends CachedSource { String _revisionCachePath(PackageId id, SystemCache cache) => p.join( cache.rootDirForSource(this), - '${_repoName(id.description.description as GitDescription)}-${(id.description as GitResolvedDescription).resolvedRef}', + '${_repoName(id.description.description as GitDescription)}-${(id.description as ResolvedGitDescription).resolvedRef}', ); /// Returns the path to the canonical clone of the repository referred to by @@ -835,13 +835,13 @@ class GitDescription extends Description { } } -class GitResolvedDescription extends ResolvedDescription { +class ResolvedGitDescription extends ResolvedDescription { @override GitDescription get description => super.description as GitDescription; final String resolvedRef; - GitResolvedDescription(GitDescription super.description, this.resolvedRef); + ResolvedGitDescription(GitDescription super.description, this.resolvedRef); @override String format() { @@ -869,7 +869,7 @@ class GitResolvedDescription extends ResolvedDescription { @override bool operator ==(Object other) { - return other is GitResolvedDescription && + return other is ResolvedGitDescription && other.description == description && other.resolvedRef == resolvedRef; } diff --git a/test/get/git/ssh_url_test.dart b/test/get/git/ssh_url_test.dart index 9832024f74..f71db0e949 100644 --- a/test/get/git/ssh_url_test.dart +++ b/test/get/git/ssh_url_test.dart @@ -39,7 +39,7 @@ void main() { 'path': 'abc/', }, ); - final resolvedDescription = GitResolvedDescription( + final resolvedDescription = ResolvedGitDescription( description, '7d48f902b0326fc2ce0615c20f1aab6c811fe55b', );