@@ -264,17 +264,35 @@ final class PackageToolTests: CommandsTestCase {
264
264
265
265
// Perform an initial fetch.
266
266
_ = try execute ( [ " resolve " ] , packagePath: packageRoot)
267
- var path = try SwiftPM . packagePath ( for: " Foo " , packageRoot: packageRoot)
268
- XCTAssertEqual ( try GitRepository ( path: path) . getTags ( ) , [ " 1.2.3 " ] )
269
267
270
- // Retag the dependency, and update.
271
- let repo = GitRepository ( path: fixturePath. appending ( " Foo " ) )
268
+ do {
269
+ let checkoutPath = try SwiftPM . packagePath ( for: " Foo " , packageRoot: packageRoot)
270
+ let checkoutRepo = GitRepository ( path: checkoutPath)
271
+ XCTAssertEqual ( try checkoutRepo. getTags ( ) , [ " 1.2.3 " ] )
272
+ _ = try checkoutRepo. revision ( forTag: " 1.2.3 " )
273
+ }
274
+
275
+
276
+ // update and retag the dependency, and update.
277
+ let repoPath = fixturePath. appending ( " Foo " )
278
+ let repo = GitRepository ( path: repoPath)
279
+ try localFileSystem. writeFileContents ( repoPath. appending ( " test " ) , string: " test " )
280
+ try repo. stageEverything ( )
281
+ try repo. commit ( )
272
282
try repo. tag ( name: " 1.2.4 " )
283
+
284
+ // we will validate it is there
285
+ let revision = try repo. revision ( forTag: " 1.2.4 " )
286
+
273
287
_ = try execute ( [ " update " ] , packagePath: packageRoot)
274
288
275
- // We shouldn't assume package path will be same after an update so ask again for it.
276
- path = try SwiftPM . packagePath ( for: " Foo " , packageRoot: packageRoot)
277
- XCTAssertEqual ( try GitRepository ( path: path) . getTags ( ) , [ " 1.2.3 " , " 1.2.4 " ] )
289
+ do {
290
+ // We shouldn't assume package path will be same after an update so ask again for it.
291
+ let checkoutPath = try SwiftPM . packagePath ( for: " Foo " , packageRoot: packageRoot)
292
+ let checkoutRepo = GitRepository ( path: checkoutPath)
293
+ // tag may not be there, but revision should be after update
294
+ XCTAssertTrue ( checkoutRepo. exists ( revision: . init( identifier: revision) ) )
295
+ }
278
296
}
279
297
}
280
298
0 commit comments