@@ -14,18 +14,7 @@ public void ResetANewlyInitializedBareRepositoryThrows()
1414
1515 using ( var repo = new Repository ( repoPath ) )
1616 {
17- Assert . Throws < BareRepositoryException > ( ( ) => repo . Reset ( ) ) ;
18- }
19- }
20-
21- [ Fact ]
22- public void ResetANewlyInitializedNonBareRepositoryThrows ( )
23- {
24- string repoPath = InitNewRepository ( false ) ;
25-
26- using ( var repo = new Repository ( repoPath ) )
27- {
28- Assert . Throws < UnbornBranchException > ( ( ) => repo . Reset ( ) ) ;
17+ Assert . Throws < BareRepositoryException > ( ( ) => repo . Index . Replace ( repo . Head . Tip ) ) ;
2918 }
3019 }
3120
@@ -35,7 +24,7 @@ public void ResettingInABareRepositoryThrows()
3524 string path = SandboxBareTestRepo ( ) ;
3625 using ( var repo = new Repository ( path ) )
3726 {
38- Assert . Throws < BareRepositoryException > ( ( ) => repo . Reset ( ) ) ;
27+ Assert . Throws < BareRepositoryException > ( ( ) => repo . Index . Replace ( repo . Head . Tip ) ) ;
3928 }
4029 }
4130
@@ -70,7 +59,7 @@ public void ResetTheIndexWithTheHeadUnstagesEverything()
7059
7160 var reflogEntriesCount = repo . Refs . Log ( repo . Refs . Head ) . Count ( ) ;
7261
73- repo . Reset ( ) ;
62+ repo . Index . Replace ( repo . Head . Tip ) ;
7463
7564 RepositoryStatus newStatus = repo . RetrieveStatus ( ) ;
7665 Assert . Equal ( 0 , newStatus . Where ( IsStaged ) . Count ( ) ) ;
@@ -80,31 +69,13 @@ public void ResetTheIndexWithTheHeadUnstagesEverything()
8069 }
8170 }
8271
83- [ Fact ]
84- public void CanResetTheIndexToTheContentOfACommitWithCommittishAsArgument ( )
85- {
86- string path = SandboxStandardTestRepo ( ) ;
87- using ( var repo = new Repository ( path ) )
88- {
89- repo . Reset ( "be3563a" ) ;
90-
91- RepositoryStatus newStatus = repo . RetrieveStatus ( ) ;
92-
93- var expected = new [ ] { "1.txt" , Path . Combine ( "1" , "branch_file.txt" ) , "deleted_staged_file.txt" ,
94- "deleted_unstaged_file.txt" , "modified_staged_file.txt" , "modified_unstaged_file.txt" } ;
95-
96- Assert . Equal ( expected . Length , newStatus . Where ( IsStaged ) . Count ( ) ) ;
97- Assert . Equal ( expected , newStatus . Removed . Select ( s => s . FilePath ) ) ;
98- }
99- }
100-
10172 [ Fact ]
10273 public void CanResetTheIndexToTheContentOfACommitWithCommitAsArgument ( )
10374 {
10475 string path = SandboxStandardTestRepo ( ) ;
10576 using ( var repo = new Repository ( path ) )
10677 {
107- repo . Reset ( repo . Lookup < Commit > ( "be3563a" ) ) ;
78+ repo . Index . Replace ( repo . Lookup < Commit > ( "be3563a" ) ) ;
10879
10980 RepositoryStatus newStatus = repo . RetrieveStatus ( ) ;
11081
@@ -116,26 +87,13 @@ public void CanResetTheIndexToTheContentOfACommitWithCommitAsArgument()
11687 }
11788 }
11889
119- [ Fact ]
120- public void CanResetTheIndexToASubsetOfTheContentOfACommitWithCommittishAsArgument ( )
121- {
122- string path = SandboxStandardTestRepo ( ) ;
123- using ( var repo = new Repository ( path ) )
124- {
125- repo . Reset ( "5b5b025" , new [ ] { "new.txt" } ) ;
126-
127- Assert . Equal ( "a8233120f6ad708f843d861ce2b7228ec4e3dec6" , repo . Index [ "README" ] . Id . Sha ) ;
128- Assert . Equal ( "fa49b077972391ad58037050f2a75f74e3671e92" , repo . Index [ "new.txt" ] . Id . Sha ) ;
129- }
130- }
131-
13290 [ Fact ]
13391 public void CanResetTheIndexToASubsetOfTheContentOfACommitWithCommitAsArgumentAndLaxUnmatchedExplicitPathsValidation ( )
13492 {
13593 string path = SandboxStandardTestRepo ( ) ;
13694 using ( var repo = new Repository ( path ) )
13795 {
138- repo . Reset ( repo . Lookup < Commit > ( "5b5b025" ) , new [ ] { "new.txt" , "non-existent-path-28.txt" } ,
96+ repo . Index . Replace ( repo . Lookup < Commit > ( "5b5b025" ) , new [ ] { "new.txt" , "non-existent-path-28.txt" } ,
13997 new ExplicitPathsOptions { ShouldFailOnUnmatchedPath = false } ) ;
14098
14199 Assert . Equal ( "a8233120f6ad708f843d861ce2b7228ec4e3dec6" , repo . Index [ "README" ] . Id . Sha ) ;
@@ -149,7 +107,7 @@ public void ResettingTheIndexToASubsetOfTheContentOfACommitWithCommitAsArgumentA
149107 using ( var repo = new Repository ( SandboxStandardTestRepo ( ) ) )
150108 {
151109 Assert . Throws < UnmatchedPathException > ( ( ) =>
152- repo . Reset ( repo . Lookup < Commit > ( "5b5b025" ) , new [ ] { "new.txt" , "non-existent-path-28.txt" } , new ExplicitPathsOptions ( ) ) ) ;
110+ repo . Index . Replace ( repo . Lookup < Commit > ( "5b5b025" ) , new [ ] { "new.txt" , "non-existent-path-28.txt" } , new ExplicitPathsOptions ( ) ) ) ;
153111 }
154112 }
155113
@@ -159,7 +117,7 @@ public void CanResetTheIndexWhenARenameExists()
159117 using ( var repo = new Repository ( SandboxStandardTestRepo ( ) ) )
160118 {
161119 repo . Move ( "branch_file.txt" , "renamed_branch_file.txt" ) ;
162- repo . Reset ( repo . Lookup < Commit > ( "32eab9c" ) ) ;
120+ repo . Index . Replace ( repo . Lookup < Commit > ( "32eab9c" ) ) ;
163121
164122 RepositoryStatus status = repo . RetrieveStatus ( ) ;
165123 Assert . Equal ( 0 , status . Where ( IsStaged ) . Count ( ) ) ;
@@ -178,7 +136,7 @@ public void CanResetSourceOfARenameInIndex()
178136 Assert . Equal ( FileStatus . Nonexistent , oldStatus [ "branch_file.txt" ] . State ) ;
179137 Assert . Equal ( FileStatus . RenamedInIndex , oldStatus [ "renamed_branch_file.txt" ] . State ) ;
180138
181- repo . Reset ( repo . Lookup < Commit > ( "32eab9c" ) , new string [ ] { "branch_file.txt" } ) ;
139+ repo . Index . Replace ( repo . Lookup < Commit > ( "32eab9c" ) , new string [ ] { "branch_file.txt" } ) ;
182140
183141 RepositoryStatus newStatus = repo . RetrieveStatus ( ) ;
184142 Assert . Equal ( 0 , newStatus . RenamedInIndex . Count ( ) ) ;
@@ -198,7 +156,7 @@ public void CanResetTargetOfARenameInIndex()
198156 Assert . Equal ( 1 , oldStatus . RenamedInIndex . Count ( ) ) ;
199157 Assert . Equal ( FileStatus . RenamedInIndex , oldStatus [ "renamed_branch_file.txt" ] . State ) ;
200158
201- repo . Reset ( repo . Lookup < Commit > ( "32eab9c" ) , new string [ ] { "renamed_branch_file.txt" } ) ;
159+ repo . Index . Replace ( repo . Lookup < Commit > ( "32eab9c" ) , new string [ ] { "renamed_branch_file.txt" } ) ;
202160
203161 RepositoryStatus newStatus = repo . RetrieveStatus ( ) ;
204162 Assert . Equal ( 0 , newStatus . RenamedInIndex . Count ( ) ) ;
0 commit comments