@@ -3477,7 +3477,7 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
34773477 } ) ,
34783478 ) ;
34793479
3480- it . effect ( "a ref snapshot changes when a fetch or commit changes refs or ancestry " , ( ) =>
3480+ it . effect ( "a ref snapshot detects branch identity, ref and ancestry changes" , ( ) =>
34813481 Effect . gen ( function * ( ) {
34823482 const cwd = yield * makeTmpDir ( ) ;
34833483 const remote = yield * makeTmpDir ( "git-vcs-driver-remote-" ) ;
@@ -3499,6 +3499,25 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
34993499 yield * git ( cwd , [ "fetch" , "origin" ] ) ;
35003500 assert . equal ( yield * snapshot , initial ) ;
35013501
3502+ yield * git ( cwd , [ "branch" , "same-commit" ] ) ;
3503+ const beforeCheckout = yield * snapshot ;
3504+ const refsBeforeCheckout = yield * git ( cwd , [ "show-ref" , "--head" ] ) ;
3505+ yield * git ( cwd , [ "checkout" , "same-commit" ] ) ;
3506+ assert . equal ( yield * git ( cwd , [ "show-ref" , "--head" ] ) , refsBeforeCheckout ) ;
3507+ const afterCheckout = yield * snapshot ;
3508+ assert . isNotNull ( afterCheckout ) ;
3509+ assert . notEqual ( afterCheckout , beforeCheckout ) ;
3510+ yield * git ( cwd , [ "checkout" , "--detach" ] ) ;
3511+ assert . equal ( yield * git ( cwd , [ "show-ref" , "--head" ] ) , refsBeforeCheckout ) ;
3512+ const detached = yield * snapshot ;
3513+ assert . isNotNull ( detached ) ;
3514+ assert . notEqual ( detached , beforeCheckout ) ;
3515+ assert . notEqual ( detached , afterCheckout ) ;
3516+ assert . equal ( yield * snapshot , detached ) ;
3517+ yield * git ( cwd , [ "checkout" , initialBranch ] ) ;
3518+ assert . equal ( yield * snapshot , beforeCheckout ) ;
3519+ yield * git ( cwd , [ "branch" , "-d" , "same-commit" ] ) ;
3520+
35023521 yield * writeTextFile ( updater , "remote.txt" , "remote\n" ) ;
35033522 yield * git ( updater , [ "add" , "remote.txt" ] ) ;
35043523 yield * git ( updater , [ "commit" , "-m" , "remote commit" ] ) ;
0 commit comments