@@ -17,8 +17,8 @@ public class BranchFixture : BaseFixture
17
17
[ InlineData ( "Ångström" ) ]
18
18
public void CanCreateBranch ( string name )
19
19
{
20
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
21
- using ( var repo = new Repository ( path . RepositoryPath ) )
20
+ string path = CloneBareTestRepo ( ) ;
21
+ using ( var repo = new Repository ( path ) )
22
22
{
23
23
Branch newBranch = repo . CreateBranch ( name , "be3563ae3f795b2b4353bcce3a527ad0a4f7f644" ) ;
24
24
Assert . NotNull ( newBranch ) ;
@@ -35,8 +35,8 @@ public void CanCreateBranch(string name)
35
35
[ Fact ]
36
36
public void CanCreateBranchUsingAbbreviatedSha ( )
37
37
{
38
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
39
- using ( var repo = new Repository ( path . RepositoryPath ) )
38
+ string path = CloneBareTestRepo ( ) ;
39
+ using ( var repo = new Repository ( path ) )
40
40
{
41
41
const string name = "unit_test" ;
42
42
Branch newBranch = repo . CreateBranch ( name , "be3563a" ) ;
@@ -48,8 +48,8 @@ public void CanCreateBranchUsingAbbreviatedSha()
48
48
[ Fact ]
49
49
public void CanCreateBranchFromImplicitHead ( )
50
50
{
51
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
52
- using ( var repo = new Repository ( path . RepositoryPath ) )
51
+ string path = CloneBareTestRepo ( ) ;
52
+ using ( var repo = new Repository ( path ) )
53
53
{
54
54
const string name = "unit_test" ;
55
55
Branch newBranch = repo . CreateBranch ( name ) ;
@@ -66,8 +66,8 @@ public void CanCreateBranchFromImplicitHead()
66
66
[ Fact ]
67
67
public void CanCreateBranchFromExplicitHead ( )
68
68
{
69
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
70
- using ( var repo = new Repository ( path . RepositoryPath ) )
69
+ string path = CloneBareTestRepo ( ) ;
70
+ using ( var repo = new Repository ( path ) )
71
71
{
72
72
const string name = "unit_test" ;
73
73
Branch newBranch = repo . CreateBranch ( name , "HEAD" ) ;
@@ -79,8 +79,8 @@ public void CanCreateBranchFromExplicitHead()
79
79
[ Fact ]
80
80
public void CanCreateBranchFromCommit ( )
81
81
{
82
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
83
- using ( var repo = new Repository ( path . RepositoryPath ) )
82
+ string path = CloneBareTestRepo ( ) ;
83
+ using ( var repo = new Repository ( path ) )
84
84
{
85
85
const string name = "unit_test" ;
86
86
var commit = repo . Lookup < Commit > ( "HEAD" ) ;
@@ -93,8 +93,8 @@ public void CanCreateBranchFromCommit()
93
93
[ Fact ]
94
94
public void CanCreateBranchFromRevparseSpec ( )
95
95
{
96
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
97
- using ( var repo = new Repository ( path . RepositoryPath ) )
96
+ string path = CloneBareTestRepo ( ) ;
97
+ using ( var repo = new Repository ( path ) )
98
98
{
99
99
const string name = "revparse_branch" ;
100
100
var target = repo . Lookup < Commit > ( "master~2" ) ;
@@ -107,8 +107,8 @@ public void CanCreateBranchFromRevparseSpec()
107
107
[ Fact ]
108
108
public void CreatingABranchFromATagPeelsToTheCommit ( )
109
109
{
110
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
111
- using ( var repo = new Repository ( path . RepositoryPath ) )
110
+ string path = CloneBareTestRepo ( ) ;
111
+ using ( var repo = new Repository ( path ) )
112
112
{
113
113
const string name = "i-peel-tag" ;
114
114
Branch newBranch = repo . CreateBranch ( name , "refs/tags/test" ) ;
@@ -120,8 +120,8 @@ public void CreatingABranchFromATagPeelsToTheCommit()
120
120
[ Fact ]
121
121
public void CreatingABranchTriggersTheCreationOfADirectReference ( )
122
122
{
123
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
124
- using ( var repo = new Repository ( path . RepositoryPath ) )
123
+ string path = CloneBareTestRepo ( ) ;
124
+ using ( var repo = new Repository ( path ) )
125
125
{
126
126
Branch newBranch = repo . CreateBranch ( "clone-of-master" ) ;
127
127
Assert . False ( newBranch . IsCurrentRepositoryHead ) ;
@@ -193,9 +193,8 @@ public void CanListAllBranches()
193
193
[ Fact ]
194
194
public void CanListBranchesWithRemoteAndLocalBranchWithSameShortName ( )
195
195
{
196
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoWorkingDirPath ) ;
197
-
198
- using ( var repo = new Repository ( path . RepositoryPath ) )
196
+ string path = CloneStandardTestRepo ( ) ;
197
+ using ( var repo = new Repository ( path ) )
199
198
{
200
199
// Create a local branch with the same short name as a remote branch.
201
200
repo . Branches . Add ( "origin/master" , repo . Branches [ "origin/test" ] . Tip ) ;
@@ -316,8 +315,8 @@ public void CanLookupLocalBranch()
316
315
[ Fact ]
317
316
public void CanLookupABranchWhichNameIsMadeOfNon7BitsAsciiCharacters ( )
318
317
{
319
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
320
- using ( var repo = new Repository ( path . RepositoryPath ) )
318
+ string path = CloneBareTestRepo ( ) ;
319
+ using ( var repo = new Repository ( path ) )
321
320
{
322
321
const string name = "Ångström" ;
323
322
Branch newBranch = repo . CreateBranch ( name , "be3563a" ) ;
@@ -368,8 +367,8 @@ public void CanGetInformationFromUnbornBranch()
368
367
[ Fact ]
369
368
public void CanGetTrackingInformationFromBranchSharingNoHistoryWithItsTrackedBranch ( )
370
369
{
371
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoWorkingDirPath ) ;
372
- using ( var repo = new Repository ( path . RepositoryPath ) )
370
+ string path = CloneStandardTestRepo ( ) ;
371
+ using ( var repo = new Repository ( path ) )
373
372
{
374
373
Branch master = repo . Branches [ "master" ] ;
375
374
repo . Refs . UpdateTarget ( "refs/remotes/origin/master" , "origin/test" ) ;
@@ -460,9 +459,8 @@ public void CanSetUpstreamBranch()
460
459
const string testBranchName = "branchToSetUpstreamInfoFor" ;
461
460
const string upstreamBranchName = "refs/remotes/origin/master" ;
462
461
463
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoPath ) ;
464
-
465
- using ( var repo = new Repository ( path . RepositoryPath ) )
462
+ string path = CloneStandardTestRepo ( ) ;
463
+ using ( var repo = new Repository ( path ) )
466
464
{
467
465
Branch branch = repo . CreateBranch ( testBranchName ) ;
468
466
Assert . False ( branch . IsTracking ) ;
@@ -494,9 +492,8 @@ public void CanSetUpstreamMergeBranch()
494
492
const string upstreamBranchName = "refs/remotes/origin/master" ;
495
493
const string upstreamRemoteName = "origin" ;
496
494
497
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoPath ) ;
498
-
499
- using ( var repo = new Repository ( path . RepositoryPath ) )
495
+ string path = CloneStandardTestRepo ( ) ;
496
+ using ( var repo = new Repository ( path ) )
500
497
{
501
498
Branch branch = repo . CreateBranch ( testBranchName ) ;
502
499
Assert . False ( branch . IsTracking ) ;
@@ -524,9 +521,8 @@ public void CanSetLocalUpstreamBranch()
524
521
const string testBranchName = "branchToSetUpstreamInfoFor" ;
525
522
const string upstreamBranchName = "refs/heads/master" ;
526
523
527
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoPath ) ;
528
-
529
- using ( var repo = new Repository ( path . RepositoryPath ) )
524
+ string path = CloneStandardTestRepo ( ) ;
525
+ using ( var repo = new Repository ( path ) )
530
526
{
531
527
Branch branch = repo . CreateBranch ( testBranchName ) ;
532
528
Assert . False ( branch . IsTracking ) ;
@@ -562,8 +558,8 @@ public void CanUnsetUpstreamBranch()
562
558
const string testBranchName = "branchToSetUpstreamInfoFor" ;
563
559
const string upstreamBranchName = "refs/remotes/origin/master" ;
564
560
565
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoPath ) ;
566
- using ( var repo = new Repository ( path . RepositoryPath ) )
561
+ string path = CloneStandardTestRepo ( ) ;
562
+ using ( var repo = new Repository ( path ) )
567
563
{
568
564
Branch branch = repo . CreateBranch ( testBranchName ) ;
569
565
Assert . False ( branch . IsTracking ) ;
@@ -594,9 +590,8 @@ public void CanWalkCommitsFromBranch()
594
590
595
591
private void AssertRemoval ( string branchName , bool isRemote , bool shouldPreviouslyAssertExistence )
596
592
{
597
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoPath ) ;
598
-
599
- using ( var repo = new Repository ( path . RepositoryPath ) )
593
+ string path = CloneStandardTestRepo ( ) ;
594
+ using ( var repo = new Repository ( path ) )
600
595
{
601
596
if ( shouldPreviouslyAssertExistence )
602
597
{
@@ -622,9 +617,8 @@ public void CanRemoveAnExistingNamedBranch(string branchName, bool isRemote)
622
617
[ InlineData ( "origin/br2" ) ]
623
618
public void CanRemoveAnExistingBranch ( string branchName )
624
619
{
625
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoPath ) ;
626
-
627
- using ( var repo = new Repository ( path . RepositoryPath ) )
620
+ string path = CloneStandardTestRepo ( ) ;
621
+ using ( var repo = new Repository ( path ) )
628
622
{
629
623
Branch curBranch = repo . Branches [ branchName ] ;
630
624
@@ -693,8 +687,8 @@ public void OnlyOneBranchIsTheHead()
693
687
[ Fact ]
694
688
public void TwoBranchesPointingAtTheSameCommitAreNotBothCurrent ( )
695
689
{
696
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
697
- using ( var repo = new Repository ( path . RepositoryPath ) )
690
+ string path = CloneBareTestRepo ( ) ;
691
+ using ( var repo = new Repository ( path ) )
698
692
{
699
693
Branch master = repo . Branches [ "refs/heads/master" ] ;
700
694
@@ -706,8 +700,8 @@ public void TwoBranchesPointingAtTheSameCommitAreNotBothCurrent()
706
700
[ Fact ]
707
701
public void CanMoveABranch ( )
708
702
{
709
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
710
- using ( var repo = new Repository ( path . RepositoryPath ) )
703
+ string path = CloneBareTestRepo ( ) ;
704
+ using ( var repo = new Repository ( path ) )
711
705
{
712
706
Assert . Null ( repo . Branches [ "br3" ] ) ;
713
707
@@ -731,8 +725,8 @@ public void BlindlyMovingABranchOverAnExistingOneThrows()
731
725
[ Fact ]
732
726
public void CanMoveABranchWhileOverwritingAnExistingOne ( )
733
727
{
734
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( ) ;
735
- using ( var repo = new Repository ( path . RepositoryPath ) )
728
+ string path = CloneBareTestRepo ( ) ;
729
+ using ( var repo = new Repository ( path ) )
736
730
{
737
731
Branch test = repo . Branches [ "test" ] ;
738
732
Assert . NotNull ( test ) ;
@@ -756,8 +750,8 @@ public void CanMoveABranchWhileOverwritingAnExistingOne()
756
750
[ Fact ]
757
751
public void DetachedHeadIsNotATrackingBranch ( )
758
752
{
759
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoWorkingDirPath ) ;
760
- using ( var repo = new Repository ( path . DirectoryPath ) )
753
+ string path = CloneStandardTestRepo ( ) ;
754
+ using ( var repo = new Repository ( path ) )
761
755
{
762
756
repo . Reset ( ResetOptions . Hard ) ;
763
757
repo . RemoveUntrackedFiles ( ) ;
0 commit comments