Skip to content

Commit be4e429

Browse files
committed
[Workspace] Skip repository update when reasking for containers
1 parent d6c2143 commit be4e429

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Sources/PackageGraph/RepositoryPackageContainerProvider.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,17 @@ public class RepositoryPackageContainerProvider: PackageContainerProvider {
5353
public func getContainer(
5454
for identifier: Container.Identifier,
5555
completion: @escaping (Result<Container, AnyError>) -> Void
56+
) {
57+
getContainer(for: identifier, skipUpdate: false, completion: completion)
58+
}
59+
60+
public func getContainer(
61+
for identifier: Container.Identifier,
62+
skipUpdate: Bool,
63+
completion: @escaping (Result<Container, AnyError>) -> Void
5664
) {
5765
// Resolve the container using the repository manager.
58-
repositoryManager.lookup(repository: identifier) { result in
66+
repositoryManager.lookup(repository: identifier, skipUpdate: skipUpdate) { result in
5967
// Create the container wrapper.
6068
let container = result.mapAny { handle -> Container in
6169
// Open the repository.

Sources/Workspace/Workspace.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,9 @@ extension Workspace {
10791079

10801080
case .revision(let identifier):
10811081
// Get the latest revision from the container.
1082-
let container = try await { containerProvider.getContainer(for: specifier, completion: $0) }
1082+
let container = try await {
1083+
containerProvider.getContainer(for: specifier, skipUpdate: true, completion: $0)
1084+
}
10831085
var revision = try container.getRevision(forIdentifier: identifier)
10841086
let branch = identifier == revision.identifier ? nil : identifier
10851087

@@ -1333,7 +1335,7 @@ extension Workspace {
13331335
// way to get it back out of the resolver which is very
13341336
// annoying. Maybe we should make an SPI on the provider for
13351337
// this?
1336-
let container = try await { containerProvider.getContainer(for: specifier, completion: $0) }
1338+
let container = try await { containerProvider.getContainer(for: specifier, skipUpdate: true, completion: $0) }
13371339
let checkoutState: CheckoutState
13381340

13391341
switch requirement {

0 commit comments

Comments
 (0)