@@ -129,17 +129,17 @@ class GitRepositoryTests: XCTestCase {
129
129
/// In order to be stable, this test uses a static test git repository in
130
130
/// `Inputs`, which has known commit hashes. See the `construct.sh` script
131
131
/// contained within it for more information.
132
- func testRawRepository( ) throws {
132
+ func testRawRepository( ) async throws {
133
133
try XCTSkipOnWindows ( because: " https://github.com/swiftlang/swift-package-manager/issues/8385: test repository has non-portable file names " )
134
134
try XCTSkipOnWindows ( because: " https://github.com/swiftlang/swift-package-manager/issues/8564 " , skipSelfHostedCI: true )
135
135
136
- try testWithTemporaryDirectory { path in
136
+ try await testWithTemporaryDirectory { path in
137
137
// Unarchive the static test repository.
138
138
let inputArchivePath = AbsolutePath ( #file) . parentDirectory. appending ( components: " Inputs " , " TestRepo.tgz " )
139
139
#if os(Windows)
140
- try systemQuietly ( [ " tar.exe " , " -x " , " -v " , " -C " , path. pathString, " -f " , inputArchivePath. pathString] )
140
+ try await AsyncProcess . checkNonZeroExit ( args : " tar.exe " , " -x " , " -v " , " -C " , path. pathString, " -f " , inputArchivePath. pathString)
141
141
#else
142
- try systemQuietly ( [ " tar " , " --no-same-owner " , " -x " , " -v " , " -C " , path. pathString, " -f " , inputArchivePath. pathString] )
142
+ try await AsyncProcess . checkNonZeroExit ( args : " tar " , " --no-same-owner " , " -x " , " -v " , " -C " , path. pathString, " -f " , inputArchivePath. pathString)
143
143
#endif
144
144
let testRepoPath = path. appending ( " TestRepo " )
145
145
@@ -400,7 +400,7 @@ class GitRepositoryTests: XCTestCase {
400
400
401
401
// Create a bare clone it somewhere because we want to later push into the repo.
402
402
let testBareRepoPath = path. appending ( " test-repo-bare " )
403
- try systemQuietly ( [ Git . tool, " clone " , " --bare " , testRepoPath. pathString, testBareRepoPath. pathString] )
403
+ try await AsyncProcess . checkNonZeroExit ( args : Git . tool, " clone " , " --bare " , testRepoPath. pathString, testBareRepoPath. pathString)
404
404
405
405
// Clone it somewhere.
406
406
let testClonePath = path. appending ( " clone " )
@@ -427,9 +427,9 @@ class GitRepositoryTests: XCTestCase {
427
427
}
428
428
}
429
429
430
- func testSetRemote( ) throws {
430
+ func testSetRemote( ) async throws {
431
431
try XCTSkipOnWindows ( because: " https://github.com/swiftlang/swift-package-manager/issues/8564 " , skipSelfHostedCI: true )
432
- try testWithTemporaryDirectory { path in
432
+ try await testWithTemporaryDirectory { path in
433
433
// Create a repo.
434
434
let testRepoPath = path. appending ( " test-repo " )
435
435
try makeDirectories ( testRepoPath)
@@ -440,7 +440,7 @@ class GitRepositoryTests: XCTestCase {
440
440
XCTAssert ( try repo. remotes ( ) . isEmpty)
441
441
442
442
// Add a remote via git cli.
443
- try systemQuietly ( [ Git . tool, " -C " , testRepoPath. pathString, " remote " , " add " , " origin " , " ../foo " ] )
443
+ try await AsyncProcess . checkNonZeroExit ( args : Git . tool, " -C " , testRepoPath. pathString, " remote " , " add " , " origin " , " ../foo " )
444
444
// Test if it was added.
445
445
XCTAssertEqual ( Dictionary ( uniqueKeysWithValues: try repo. remotes ( ) . map { ( $0. 0 , $0. 1 ) } ) , [ " origin " : " ../foo " ] )
446
446
// Change remote.
@@ -486,9 +486,9 @@ class GitRepositoryTests: XCTestCase {
486
486
}
487
487
}
488
488
489
- func testBranchOperations( ) throws {
489
+ func testBranchOperations( ) async throws {
490
490
try XCTSkipOnWindows ( because: " https://github.com/swiftlang/swift-package-manager/issues/8564 " , skipSelfHostedCI: true )
491
- try testWithTemporaryDirectory { path in
491
+ try await testWithTemporaryDirectory { path in
492
492
// Create a repo.
493
493
let testRepoPath = path. appending ( " test-repo " )
494
494
try makeDirectories ( testRepoPath)
@@ -501,7 +501,7 @@ class GitRepositoryTests: XCTestCase {
501
501
// Check a non existent revision.
502
502
XCTAssertFalse ( repo. exists ( revision: Revision ( identifier: " nonExistent " ) ) )
503
503
// Checkout a new branch using command line.
504
- try systemQuietly ( [ Git . tool, " -C " , testRepoPath. pathString, " checkout " , " -b " , " TestBranch1 " ] )
504
+ try await AsyncProcess . checkNonZeroExit ( args : Git . tool, " -C " , testRepoPath. pathString, " checkout " , " -b " , " TestBranch1 " )
505
505
XCTAssertTrue ( repo. exists ( revision: Revision ( identifier: " TestBranch1 " ) ) )
506
506
XCTAssertEqual ( try repo. getCurrentRevision ( ) , currentRevision)
507
507
@@ -658,7 +658,7 @@ class GitRepositoryTests: XCTestCase {
658
658
try bar. commit ( )
659
659
660
660
// Update the ref of bar in foo and tag as 1.0.2
661
- try systemQuietly ( [ Git . tool, " -C " , fooPath. appending ( " bar " ) . pathString, " pull " ] )
661
+ try await AsyncProcess . checkNonZeroExit ( args : Git . tool, " -C " , fooPath. appending ( " bar " ) . pathString, " pull " )
662
662
try foo. stageEverything ( )
663
663
try foo. commit ( )
664
664
try foo. tag ( name: " 1.0.2 " )
@@ -761,10 +761,10 @@ class GitRepositoryTests: XCTestCase {
761
761
762
762
// Create a `newMain` branch and remove `main`.
763
763
try repo. checkout ( newBranch: " newMain " )
764
- try systemQuietly ( [ Git . tool, " -C " , testRepoPath. pathString, " branch " , " -D " , " main " ] )
764
+ try await AsyncProcess . checkNonZeroExit ( args : Git . tool, " -C " , testRepoPath. pathString, " branch " , " -D " , " main " )
765
765
766
766
// Change the branch name to something non-existent.
767
- try systemQuietly ( [ Git . tool, " -C " , testRepoPath. pathString, " symbolic-ref " , " HEAD " , " refs/heads/_non_existent_branch_ " ] )
767
+ try await AsyncProcess . checkNonZeroExit ( args : Git . tool, " -C " , testRepoPath. pathString, " symbolic-ref " , " HEAD " , " refs/heads/_non_existent_branch_ " )
768
768
769
769
// Clone it somewhere.
770
770
let testClonePath = path. appending ( " clone " )
@@ -790,7 +790,7 @@ class GitRepositoryTests: XCTestCase {
790
790
791
791
func testValidDirectoryLocalRelativeOrigin( ) async throws {
792
792
try XCTSkipOnWindows ( because: " https://github.com/swiftlang/swift-package-manager/issues/8564 " , skipSelfHostedCI: true )
793
- try testWithTemporaryDirectory { tmpDir in
793
+ try await testWithTemporaryDirectory { tmpDir in
794
794
// Create a repository.
795
795
let packageDir = tmpDir. appending ( " SomePackage " )
796
796
try localFileSystem. createDirectory ( packageDir)
@@ -813,7 +813,7 @@ class GitRepositoryTests: XCTestCase {
813
813
814
814
initGitRepo ( packageDir)
815
815
// Set the remote.
816
- try systemQuietly ( [ Git . tool, " -C " , packageDir. pathString, " remote " , " add " , " origin " , customRemote] )
816
+ try await AsyncProcess . checkNonZeroExit ( args : Git . tool, " -C " , packageDir. pathString, " remote " , " add " , " origin " , customRemote)
817
817
XCTAssertTrue ( try repositoryManager. isValidDirectory ( packageDir) )
818
818
819
819
let customRemoteWithoutPathExtension = ( customRemote as NSString ) . deletingPathExtension
@@ -837,7 +837,7 @@ class GitRepositoryTests: XCTestCase {
837
837
838
838
func testValidDirectoryLocalAbsoluteOrigin( ) async throws {
839
839
try XCTSkipOnWindows ( because: " https://github.com/swiftlang/swift-package-manager/issues/8564 " , skipSelfHostedCI: true )
840
- try testWithTemporaryDirectory { tmpDir in
840
+ try await testWithTemporaryDirectory { tmpDir in
841
841
// Create a repository.
842
842
let packageDir = tmpDir. appending ( " SomePackage " )
843
843
try localFileSystem. createDirectory ( packageDir)
@@ -860,7 +860,7 @@ class GitRepositoryTests: XCTestCase {
860
860
861
861
initGitRepo ( packageDir)
862
862
// Set the remote.
863
- try systemQuietly ( [ Git . tool, " -C " , packageDir. pathString, " remote " , " add " , " origin " , customRemote. pathString] )
863
+ try await AsyncProcess . checkNonZeroExit ( args : Git . tool, " -C " , packageDir. pathString, " remote " , " add " , " origin " , customRemote. pathString)
864
864
XCTAssertTrue ( try repositoryManager. isValidDirectory ( packageDir) )
865
865
866
866
let customRemotePath = customRemote. pathString
@@ -888,7 +888,7 @@ class GitRepositoryTests: XCTestCase {
888
888
889
889
func testValidDirectoryRemoteOrigin( ) async throws {
890
890
try XCTSkipOnWindows ( because: " https://github.com/swiftlang/swift-package-manager/issues/8564 " , skipSelfHostedCI: true )
891
- try testWithTemporaryDirectory { tmpDir in
891
+ try await testWithTemporaryDirectory { tmpDir in
892
892
// Create a repository.
893
893
let packageDir = tmpDir. appending ( " SomePackage " )
894
894
try localFileSystem. createDirectory ( packageDir)
@@ -910,7 +910,7 @@ class GitRepositoryTests: XCTestCase {
910
910
911
911
initGitRepo ( packageDir)
912
912
// Set the remote.
913
- try systemQuietly ( [ Git . tool, " -C " , packageDir. pathString, " remote " , " add " , " origin " , customRemote. absoluteString] )
913
+ try await AsyncProcess . checkNonZeroExit ( args : Git . tool, " -C " , packageDir. pathString, " remote " , " add " , " origin " , customRemote. absoluteString)
914
914
XCTAssertTrue ( try repositoryManager. isValidDirectory ( packageDir) )
915
915
916
916
XCTAssertTrue ( try repositoryManager. isValidDirectory ( packageDir, for: RepositorySpecifier ( url: SourceControlURL ( customRemote) ) ) )
0 commit comments