@@ -61,11 +61,11 @@ class GitRepositoryTests: XCTestCase {
61
61
}
62
62
63
63
/// Test the basic provider functions.
64
- func testProvider( ) throws {
64
+ func testProvider( ) async throws {
65
65
// Skipping all tests that call git on Windows.
66
66
// We have a hang in CI when running in parallel.
67
67
try XCTSkipOnWindows ( because: " https://github.com/swiftlang/swift-package-manager/issues/8564 " , skipSelfHostedCI: true )
68
- try testWithTemporaryDirectory { path in
68
+ try await testWithTemporaryDirectory { path in
69
69
let testRepoPath = path. appending ( " test-repo " )
70
70
try ! makeDirectories ( testRepoPath)
71
71
initGitRepo ( testRepoPath, tag: " 1.2.3 " )
@@ -75,7 +75,7 @@ class GitRepositoryTests: XCTestCase {
75
75
let provider = GitRepositoryProvider ( )
76
76
XCTAssertTrue ( try provider. workingCopyExists ( at: testRepoPath) )
77
77
let repoSpec = RepositorySpecifier ( path: testRepoPath)
78
- try provider. fetch ( repository: repoSpec, to: testCheckoutPath)
78
+ try await provider. fetch ( repository: repoSpec, to: testCheckoutPath)
79
79
80
80
// Verify the checkout was made.
81
81
XCTAssertDirectoryExists ( testCheckoutPath)
@@ -87,18 +87,19 @@ class GitRepositoryTests: XCTestCase {
87
87
88
88
let revision = try repository. resolveRevision ( tag: tags. first ?? " <invalid> " )
89
89
// FIXME: It would be nice if we had a deterministic hash here...
90
- XCTAssertEqual ( revision. identifier,
91
- try AsyncProcess . popen (
92
- args: Git . tool, " -C " , testRepoPath. pathString, " rev-parse " , " --verify " , " 1.2.3 " ) . utf8Output ( ) . spm_chomp ( ) )
90
+ let testRepoRevParsed = try await AsyncProcess . popen ( args: Git . tool, " -C " , testRepoPath. pathString, " rev-parse " , " --verify " , " 1.2.3 " )
91
+ . utf8Output ( )
92
+ . spm_chomp ( )
93
+ XCTAssertEqual ( revision. identifier, testRepoRevParsed)
94
+
93
95
if let revision = try ? repository. resolveRevision ( tag: " <invalid> " ) {
94
96
XCTFail ( " unexpected resolution of invalid tag to \( revision) " )
95
97
}
96
98
97
99
let main = try repository. resolveRevision ( identifier: " main " )
98
-
99
- XCTAssertEqual ( main. identifier,
100
- try AsyncProcess . checkNonZeroExit (
101
- args: Git . tool, " -C " , testRepoPath. pathString, " rev-parse " , " --verify " , " main " ) . spm_chomp ( ) )
100
+ let mainRevParsed = try await AsyncProcess . checkNonZeroExit ( args: Git . tool, " -C " , testRepoPath. pathString, " rev-parse " , " --verify " , " main " )
101
+ . spm_chomp ( )
102
+ XCTAssertEqual ( main. identifier, mainRevParsed)
102
103
103
104
// Check that git hashes resolve to themselves.
104
105
let mainIdentifier = try repository. resolveRevision ( identifier: main. identifier)
@@ -213,9 +214,9 @@ class GitRepositoryTests: XCTestCase {
213
214
}
214
215
215
216
/// Test the Git file system view.
216
- func testGitFileView( ) throws {
217
+ func testGitFileView( ) async throws {
217
218
try XCTSkipOnWindows ( because: " https://github.com/swiftlang/swift-package-manager/issues/8564 " , skipSelfHostedCI: true )
218
- try testWithTemporaryDirectory { path in
219
+ try await testWithTemporaryDirectory { path in
219
220
let testRepoPath = path. appending ( " test-repo " )
220
221
try makeDirectories ( testRepoPath)
221
222
initGitRepo ( testRepoPath)
@@ -242,7 +243,7 @@ class GitRepositoryTests: XCTestCase {
242
243
let testClonePath = path. appending ( " clone " )
243
244
let provider = GitRepositoryProvider ( )
244
245
let repoSpec = RepositorySpecifier ( path: testRepoPath)
245
- try provider. fetch ( repository: repoSpec, to: testClonePath)
246
+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
246
247
let repository = provider. open ( repository: repoSpec, at: testClonePath)
247
248
248
249
// Get and test the file system view.
@@ -323,7 +324,7 @@ class GitRepositoryTests: XCTestCase {
323
324
let testClonePath = path. appending ( " clone " )
324
325
let provider = GitRepositoryProvider ( )
325
326
let repoSpec = RepositorySpecifier ( path: testRepoPath)
326
- try provider. fetch ( repository: repoSpec, to: testClonePath)
327
+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
327
328
328
329
// Clone off a checkout.
329
330
let checkoutPath = path. appending ( " checkout " )
@@ -363,7 +364,7 @@ class GitRepositoryTests: XCTestCase {
363
364
let testClonePath = path. appending ( " clone " )
364
365
let provider = GitRepositoryProvider ( )
365
366
let repoSpec = RepositorySpecifier ( path: testRepoPath)
366
- try provider. fetch ( repository: repoSpec, to: testClonePath)
367
+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
367
368
let clonedRepo = provider. open ( repository: repoSpec, at: testClonePath)
368
369
XCTAssertEqual ( try clonedRepo. getTags ( ) , [ " 1.2.3 " ] )
369
370
@@ -405,7 +406,7 @@ class GitRepositoryTests: XCTestCase {
405
406
let testClonePath = path. appending ( " clone " )
406
407
let provider = GitRepositoryProvider ( )
407
408
let repoSpec = RepositorySpecifier ( path: testBareRepoPath)
408
- try provider. fetch ( repository: repoSpec, to: testClonePath)
409
+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
409
410
410
411
// Clone off a checkout.
411
412
let checkoutPath = path. appending ( " checkout " )
@@ -614,7 +615,7 @@ class GitRepositoryTests: XCTestCase {
614
615
try foo. tag ( name: " 1.0.0 " )
615
616
616
617
// Fetch and clone repo foo.
617
- try provider. fetch ( repository: fooSpecifier, to: fooRepoPath)
618
+ try await provider. fetch ( repository: fooSpecifier, to: fooRepoPath)
618
619
_ = try await provider. createWorkingCopy ( repository: fooSpecifier, sourcePath: fooRepoPath, at: fooWorkingPath, editable: false )
619
620
620
621
let fooRepo = GitRepository ( path: fooRepoPath, isWorkingRepo: false )
@@ -690,7 +691,7 @@ class GitRepositoryTests: XCTestCase {
690
691
let testClonePath = path. appending ( " clone " )
691
692
let provider = GitRepositoryProvider ( )
692
693
let repoSpec = RepositorySpecifier ( path: testRepoPath)
693
- try provider. fetch ( repository: repoSpec, to: testClonePath)
694
+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
694
695
let clonedRepo = provider. open ( repository: repoSpec, at: testClonePath)
695
696
XCTAssertEqual ( try clonedRepo. getTags ( ) , [ " 1.2.3 " ] )
696
697
@@ -769,7 +770,7 @@ class GitRepositoryTests: XCTestCase {
769
770
let testClonePath = path. appending ( " clone " )
770
771
let provider = GitRepositoryProvider ( )
771
772
let repoSpec = RepositorySpecifier ( path: testRepoPath)
772
- try provider. fetch ( repository: repoSpec, to: testClonePath)
773
+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
773
774
let clonedRepo = provider. open ( repository: repoSpec, at: testClonePath)
774
775
XCTAssertEqual ( try clonedRepo. getTags ( ) , [ ] )
775
776
0 commit comments