@@ -119,60 +119,15 @@ public void MountFailsWhenNoOnDiskVersion()
119119 }
120120
121121 [ TestCase ]
122- public void MountFailsWhenNoLocalCacheRootInRepoMetadata ( )
122+ public void MountFailsWhenNoGitObjectsRootInGitConfig ( )
123123 {
124124 this . Enlistment . UnmountScalar ( ) ;
125+ string gitObjectsRoot = GitProcess . Invoke ( this . Enlistment . RepoRoot , "config --local gvfs.sharedCache" ) ;
126+ string . IsNullOrWhiteSpace ( gitObjectsRoot ) . ShouldBeFalse ( "gitObjects root should be set" ) ;
125127
126- string majorVersion ;
127- string minorVersion ;
128- ScalarHelpers . GetPersistedDiskLayoutVersion ( this . Enlistment . DotScalarRoot , out majorVersion , out minorVersion ) ;
129- majorVersion . ShouldNotBeNull ( ) ;
130- minorVersion . ShouldNotBeNull ( ) ;
131-
132- string objectsRoot = ScalarHelpers . GetPersistedGitObjectsRoot ( this . Enlistment . DotScalarRoot ) . ShouldNotBeNull ( ) ;
133-
134- string metadataPath = Path . Combine ( this . Enlistment . DotScalarRoot , ScalarHelpers . RepoMetadataName ) ;
135- string metadataBackupPath = metadataPath + ".backup" ;
136- this . fileSystem . MoveFile ( metadataPath , metadataBackupPath ) ;
137-
138- this . fileSystem . CreateEmptyFile ( metadataPath ) ;
139- ScalarHelpers . SaveDiskLayoutVersion ( this . Enlistment . DotScalarRoot , majorVersion , minorVersion ) ;
140- ScalarHelpers . SaveGitObjectsRoot ( this . Enlistment . DotScalarRoot , objectsRoot ) ;
141-
142- this . MountShouldFail ( "Failed to determine local cache path from repo metadata" ) ;
143-
144- this . fileSystem . DeleteFile ( metadataPath ) ;
145- this . fileSystem . MoveFile ( metadataBackupPath , metadataPath ) ;
146-
147- this . Enlistment . MountScalar ( ) ;
148- }
149-
150- [ TestCase ]
151- public void MountFailsWhenNoGitObjectsRootInRepoMetadata ( )
152- {
153- this . Enlistment . UnmountScalar ( ) ;
154-
155- string majorVersion ;
156- string minorVersion ;
157- ScalarHelpers . GetPersistedDiskLayoutVersion ( this . Enlistment . DotScalarRoot , out majorVersion , out minorVersion ) ;
158- majorVersion . ShouldNotBeNull ( ) ;
159- minorVersion . ShouldNotBeNull ( ) ;
160-
161- string localCacheRoot = ScalarHelpers . GetPersistedLocalCacheRoot ( this . Enlistment . DotScalarRoot ) . ShouldNotBeNull ( ) ;
162-
163- string metadataPath = Path . Combine ( this . Enlistment . DotScalarRoot , ScalarHelpers . RepoMetadataName ) ;
164- string metadataBackupPath = metadataPath + ".backup" ;
165- this . fileSystem . MoveFile ( metadataPath , metadataBackupPath ) ;
166-
167- this . fileSystem . CreateEmptyFile ( metadataPath ) ;
168- ScalarHelpers . SaveDiskLayoutVersion ( this . Enlistment . DotScalarRoot , majorVersion , minorVersion ) ;
169- ScalarHelpers . SaveLocalCacheRoot ( this . Enlistment . DotScalarRoot , localCacheRoot ) ;
170-
171- this . MountShouldFail ( "Failed to determine git objects root from repo metadata" ) ;
172-
173- this . fileSystem . DeleteFile ( metadataPath ) ;
174- this . fileSystem . MoveFile ( metadataBackupPath , metadataPath ) ;
175-
128+ GitProcess . Invoke ( this . Enlistment . RepoRoot , "config --local --unset-all gvfs.sharedCache" ) ;
129+ this . MountShouldFail ( "Failed to determine git objects root from git config" ) ;
130+ GitProcess . Invoke ( this . Enlistment . RepoRoot , $ "config--local gvfs.sharedCache { gitObjectsRoot } ") ;
176131 this . Enlistment . MountScalar ( ) ;
177132 }
178133
0 commit comments