@@ -61,11 +61,11 @@ class GitRepositoryTests: XCTestCase {
6161 }
6262
6363 /// Test the basic provider functions.
64- func testProvider( ) throws {
64+ func testProvider( ) async throws {
6565 // Skipping all tests that call git on Windows.
6666 // We have a hang in CI when running in parallel.
6767 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
6969 let testRepoPath = path. appending ( " test-repo " )
7070 try ! makeDirectories ( testRepoPath)
7171 initGitRepo ( testRepoPath, tag: " 1.2.3 " )
@@ -75,7 +75,7 @@ class GitRepositoryTests: XCTestCase {
7575 let provider = GitRepositoryProvider ( )
7676 XCTAssertTrue ( try provider. workingCopyExists ( at: testRepoPath) )
7777 let repoSpec = RepositorySpecifier ( path: testRepoPath)
78- try provider. fetch ( repository: repoSpec, to: testCheckoutPath)
78+ try await provider. fetch ( repository: repoSpec, to: testCheckoutPath)
7979
8080 // Verify the checkout was made.
8181 XCTAssertDirectoryExists ( testCheckoutPath)
@@ -87,18 +87,19 @@ class GitRepositoryTests: XCTestCase {
8787
8888 let revision = try repository. resolveRevision ( tag: tags. first ?? " <invalid> " )
8989 // 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+
9395 if let revision = try ? repository. resolveRevision ( tag: " <invalid> " ) {
9496 XCTFail ( " unexpected resolution of invalid tag to \( revision) " )
9597 }
9698
9799 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)
102103
103104 // Check that git hashes resolve to themselves.
104105 let mainIdentifier = try repository. resolveRevision ( identifier: main. identifier)
@@ -213,9 +214,9 @@ class GitRepositoryTests: XCTestCase {
213214 }
214215
215216 /// Test the Git file system view.
216- func testGitFileView( ) throws {
217+ func testGitFileView( ) async throws {
217218 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
219220 let testRepoPath = path. appending ( " test-repo " )
220221 try makeDirectories ( testRepoPath)
221222 initGitRepo ( testRepoPath)
@@ -242,7 +243,7 @@ class GitRepositoryTests: XCTestCase {
242243 let testClonePath = path. appending ( " clone " )
243244 let provider = GitRepositoryProvider ( )
244245 let repoSpec = RepositorySpecifier ( path: testRepoPath)
245- try provider. fetch ( repository: repoSpec, to: testClonePath)
246+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
246247 let repository = provider. open ( repository: repoSpec, at: testClonePath)
247248
248249 // Get and test the file system view.
@@ -323,7 +324,7 @@ class GitRepositoryTests: XCTestCase {
323324 let testClonePath = path. appending ( " clone " )
324325 let provider = GitRepositoryProvider ( )
325326 let repoSpec = RepositorySpecifier ( path: testRepoPath)
326- try provider. fetch ( repository: repoSpec, to: testClonePath)
327+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
327328
328329 // Clone off a checkout.
329330 let checkoutPath = path. appending ( " checkout " )
@@ -363,7 +364,7 @@ class GitRepositoryTests: XCTestCase {
363364 let testClonePath = path. appending ( " clone " )
364365 let provider = GitRepositoryProvider ( )
365366 let repoSpec = RepositorySpecifier ( path: testRepoPath)
366- try provider. fetch ( repository: repoSpec, to: testClonePath)
367+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
367368 let clonedRepo = provider. open ( repository: repoSpec, at: testClonePath)
368369 XCTAssertEqual ( try clonedRepo. getTags ( ) , [ " 1.2.3 " ] )
369370
@@ -405,7 +406,7 @@ class GitRepositoryTests: XCTestCase {
405406 let testClonePath = path. appending ( " clone " )
406407 let provider = GitRepositoryProvider ( )
407408 let repoSpec = RepositorySpecifier ( path: testBareRepoPath)
408- try provider. fetch ( repository: repoSpec, to: testClonePath)
409+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
409410
410411 // Clone off a checkout.
411412 let checkoutPath = path. appending ( " checkout " )
@@ -614,7 +615,7 @@ class GitRepositoryTests: XCTestCase {
614615 try foo. tag ( name: " 1.0.0 " )
615616
616617 // Fetch and clone repo foo.
617- try provider. fetch ( repository: fooSpecifier, to: fooRepoPath)
618+ try await provider. fetch ( repository: fooSpecifier, to: fooRepoPath)
618619 _ = try await provider. createWorkingCopy ( repository: fooSpecifier, sourcePath: fooRepoPath, at: fooWorkingPath, editable: false )
619620
620621 let fooRepo = GitRepository ( path: fooRepoPath, isWorkingRepo: false )
@@ -690,7 +691,7 @@ class GitRepositoryTests: XCTestCase {
690691 let testClonePath = path. appending ( " clone " )
691692 let provider = GitRepositoryProvider ( )
692693 let repoSpec = RepositorySpecifier ( path: testRepoPath)
693- try provider. fetch ( repository: repoSpec, to: testClonePath)
694+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
694695 let clonedRepo = provider. open ( repository: repoSpec, at: testClonePath)
695696 XCTAssertEqual ( try clonedRepo. getTags ( ) , [ " 1.2.3 " ] )
696697
@@ -769,7 +770,7 @@ class GitRepositoryTests: XCTestCase {
769770 let testClonePath = path. appending ( " clone " )
770771 let provider = GitRepositoryProvider ( )
771772 let repoSpec = RepositorySpecifier ( path: testRepoPath)
772- try provider. fetch ( repository: repoSpec, to: testClonePath)
773+ try await provider. fetch ( repository: repoSpec, to: testClonePath)
773774 let clonedRepo = provider. open ( repository: repoSpec, at: testClonePath)
774775 XCTAssertEqual ( try clonedRepo. getTags ( ) , [ ] )
775776
0 commit comments