@@ -4416,6 +4416,37 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
44164416 } ) ,
44174417 ) ;
44184418
4419+ it . effect ( "leaves FETCH_HEAD to the user's own pulls in background upstream fetches" , ( ) =>
4420+ Effect . gen ( function * ( ) {
4421+ const cwd = yield * makeTmpDir ( ) ;
4422+ const remote = yield * makeTmpDir ( "git-vcs-driver-remote-" ) ;
4423+ const updater = yield * makeTmpDir ( "git-vcs-driver-updater-" ) ;
4424+ const { initialBranch } = yield * initRepoWithCommit ( cwd ) ;
4425+ yield * git ( remote , [ "init" , "--bare" ] ) ;
4426+ yield * git ( cwd , [ "remote" , "add" , "origin" , remote ] ) ;
4427+ yield * git ( cwd , [ "push" , "-u" , "origin" , initialBranch ] ) ;
4428+
4429+ yield * git ( updater , [ "clone" , remote , "." ] ) ;
4430+ yield * git ( updater , [ "config" , "user.email" , "[email protected] " ] ) ; 4431+ yield * git ( updater , [ "config" , "user.name" , "Test" ] ) ;
4432+ yield * writeTextFile ( updater , "remote.txt" , "remote\n" ) ;
4433+ yield * git ( updater , [ "add" , "remote.txt" ] ) ;
4434+ yield * git ( updater , [ "commit" , "-m" , "remote commit" ] ) ;
4435+ yield * git ( updater , [ "push" , "origin" , initialBranch ] ) ;
4436+ const fetchHeadPath = ( yield * Path . Path ) . join ( cwd , ".git" , "FETCH_HEAD" ) ;
4437+ assert . equal ( NodeFS . existsSync ( fetchHeadPath ) , false ) ;
4438+
4439+ const status = yield * ( yield * GitVcsDriver . GitVcsDriver ) . statusDetailsRemote ( cwd ) ;
4440+
4441+ assert . equal ( status . behindCount , 1 ) ;
4442+ assert . equal (
4443+ NodeFS . existsSync ( fetchHeadPath ) ,
4444+ false ,
4445+ "background status fetch wrote .git/FETCH_HEAD, which an overlapping `git pull` merges from" ,
4446+ ) ;
4447+ } ) ,
4448+ ) ;
4449+
44194450 it . effect ( "uses origin HEAD for default-branch detection with a non-origin upstream" , ( ) =>
44204451 Effect . gen ( function * ( ) {
44214452 const cwd = yield * makeTmpDir ( ) ;
0 commit comments