@@ -36,12 +36,8 @@ public void CanUnsetAnEntryFromTheLocalConfiguration()
3636 [ Fact ]
3737 public void CanUnsetAnEntryFromTheGlobalConfiguration ( )
3838 {
39- SelfCleaningDirectory scd = BuildSelfCleaningDirectory ( ) ;
40-
41- var options = BuildFakeConfigs ( scd ) ;
42-
4339 string path = SandboxBareTestRepo ( ) ;
44- using ( var repo = new Repository ( path , options ) )
40+ using ( var repo = new Repository ( path ) )
4541 {
4642 Assert . True ( repo . Config . HasConfig ( ConfigurationLevel . Global ) ) ;
4743 Assert . Equal ( 42 , repo . Config . Get < int > ( "Wow.Man-I-am-totally-global" ) . Value ) ;
@@ -143,12 +139,10 @@ public void CanReadStringValue()
143139 [ Fact ]
144140 public void CanEnumerateGlobalConfig ( )
145141 {
146- string configPath = CreateConfigurationWithDummyUser ( Constants . Identity ) ;
147- var options = new RepositoryOptions { GlobalConfigurationLocation = configPath } ;
148-
149142 var path = SandboxStandardTestRepoGitDir ( ) ;
150- using ( var repo = new Repository ( path , options ) )
143+ using ( var repo = new Repository ( path ) )
151144 {
145+ CreateConfigurationWithDummyUser ( repo , Constants . Identity ) ;
152146 var entry = repo . Config . FirstOrDefault < ConfigurationEntry < string > > ( e => e . Key == "user.name" ) ;
153147 Assert . NotNull ( entry ) ;
154148 Assert . Equal ( Constants . Signature . Name , entry . Value ) ;
@@ -200,16 +194,14 @@ public void CanFindInLocalConfig()
200194 [ Fact ]
201195 public void CanFindInGlobalConfig ( )
202196 {
203- string configPath = CreateConfigurationWithDummyUser ( Constants . Identity ) ;
204- var options = new RepositoryOptions { GlobalConfigurationLocation = configPath } ;
205197
206198 var path = SandboxStandardTestRepoGitDir ( ) ;
207- using ( var repo = new Repository ( path , options ) )
199+ using ( var repo = new Repository ( path ) )
208200 {
209- var matches = repo . Config . Find ( @"\.name ", ConfigurationLevel . Global ) ;
201+ var matches = repo . Config . Find ( "-rocks ", ConfigurationLevel . Global ) ;
210202
211203 Assert . NotNull ( matches ) ;
212- Assert . Equal ( new [ ] { "user.name " } ,
204+ Assert . Equal ( new [ ] { "woot.this-rocks " } ,
213205 matches . Select ( m => m . Key ) . ToArray ( ) ) ;
214206 }
215207 }
@@ -331,12 +323,8 @@ public void SettingUnsupportedTypeThrows()
331323 [ Fact ]
332324 public void CanGetAnEntryFromASpecificStore ( )
333325 {
334- SelfCleaningDirectory scd = BuildSelfCleaningDirectory ( ) ;
335-
336- var options = BuildFakeConfigs ( scd ) ;
337-
338326 string path = SandboxStandardTestRepo ( ) ;
339- using ( var repo = new Repository ( path , options ) )
327+ using ( var repo = new Repository ( path ) )
340328 {
341329 Assert . True ( repo . Config . HasConfig ( ConfigurationLevel . Local ) ) ;
342330 Assert . True ( repo . Config . HasConfig ( ConfigurationLevel . Global ) ) ;
@@ -356,12 +344,8 @@ public void CanGetAnEntryFromASpecificStore()
356344 [ Fact ]
357345 public void CanTellIfASpecificStoreContainsAKey ( )
358346 {
359- SelfCleaningDirectory scd = BuildSelfCleaningDirectory ( ) ;
360-
361- var options = BuildFakeConfigs ( scd ) ;
362-
363347 string path = SandboxBareTestRepo ( ) ;
364- using ( var repo = new Repository ( path , options ) )
348+ using ( var repo = new Repository ( path ) )
365349 {
366350 Assert . True ( repo . Config . HasConfig ( ConfigurationLevel . System ) ) ;
367351
@@ -387,16 +371,14 @@ public void CanAccessConfigurationWithoutARepository(Func<string, string> localC
387371 {
388372 var path = SandboxStandardTestRepoGitDir ( ) ;
389373
390- string globalConfigPath = CreateConfigurationWithDummyUser ( Constants . Identity ) ;
391- var options = new RepositoryOptions { GlobalConfigurationLocation = globalConfigPath } ;
392-
393- using ( var repo = new Repository ( path , options ) )
374+ using ( var repo = new Repository ( path ) )
394375 {
395376 repo . Config . Set ( "my.key" , "local" ) ;
396377 repo . Config . Set ( "my.key" , "mouse" , ConfigurationLevel . Global ) ;
397378 }
398379
399- using ( var config = Configuration . BuildFrom ( localConfigurationPathProvider ( path ) , globalConfigPath ) )
380+ var globalPath = Path . Combine ( GlobalSettings . GetConfigSearchPaths ( ConfigurationLevel . Global ) . Single ( ) , ".gitconfig" ) ;
381+ using ( var config = Configuration . BuildFrom ( localConfigurationPathProvider ( path ) , globalPath ) )
400382 {
401383 Assert . Equal ( "local" , config . Get < string > ( "my.key" ) . Value ) ;
402384 Assert . Equal ( "mouse" , config . Get < string > ( "my.key" , ConfigurationLevel . Global ) . Value ) ;
@@ -418,11 +400,10 @@ public void PassingANonExistingLocalConfigurationFileToBuildFromthrowss()
418400 public void CannotBuildAProperSignatureFromConfigWhenFullIdentityCannotBeFoundInTheConfig ( string name , string email )
419401 {
420402 string repoPath = InitNewRepository ( ) ;
421- string configPath = CreateConfigurationWithDummyUser ( name , email ) ;
422- var options = new RepositoryOptions { GlobalConfigurationLocation = configPath } ;
423403
424- using ( var repo = new Repository ( repoPath , options ) )
404+ using ( var repo = new Repository ( repoPath ) )
425405 {
406+ CreateConfigurationWithDummyUser ( repo , name , email ) ;
426407 Assert . Equal ( name , repo . Config . GetValueOrDefault < string > ( "user.name" ) ) ;
427408 Assert . Equal ( email , repo . Config . GetValueOrDefault < string > ( "user.email" ) ) ;
428409
0 commit comments