@@ -14,18 +14,7 @@ public void ResetANewlyInitializedBareRepositoryThrows()
14
14
15
15
using ( var repo = new Repository ( repoPath ) )
16
16
{
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 ) ) ;
29
18
}
30
19
}
31
20
@@ -35,7 +24,7 @@ public void ResettingInABareRepositoryThrows()
35
24
string path = SandboxBareTestRepo ( ) ;
36
25
using ( var repo = new Repository ( path ) )
37
26
{
38
- Assert . Throws < BareRepositoryException > ( ( ) => repo . Reset ( ) ) ;
27
+ Assert . Throws < BareRepositoryException > ( ( ) => repo . Index . Replace ( repo . Head . Tip ) ) ;
39
28
}
40
29
}
41
30
@@ -70,7 +59,7 @@ public void ResetTheIndexWithTheHeadUnstagesEverything()
70
59
71
60
var reflogEntriesCount = repo . Refs . Log ( repo . Refs . Head ) . Count ( ) ;
72
61
73
- repo . Reset ( ) ;
62
+ repo . Index . Replace ( repo . Head . Tip ) ;
74
63
75
64
RepositoryStatus newStatus = repo . RetrieveStatus ( ) ;
76
65
Assert . Equal ( 0 , newStatus . Where ( IsStaged ) . Count ( ) ) ;
@@ -80,31 +69,13 @@ public void ResetTheIndexWithTheHeadUnstagesEverything()
80
69
}
81
70
}
82
71
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
-
101
72
[ Fact ]
102
73
public void CanResetTheIndexToTheContentOfACommitWithCommitAsArgument ( )
103
74
{
104
75
string path = SandboxStandardTestRepo ( ) ;
105
76
using ( var repo = new Repository ( path ) )
106
77
{
107
- repo . Reset ( repo . Lookup < Commit > ( "be3563a" ) ) ;
78
+ repo . Index . Replace ( repo . Lookup < Commit > ( "be3563a" ) ) ;
108
79
109
80
RepositoryStatus newStatus = repo . RetrieveStatus ( ) ;
110
81
@@ -116,26 +87,13 @@ public void CanResetTheIndexToTheContentOfACommitWithCommitAsArgument()
116
87
}
117
88
}
118
89
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
-
132
90
[ Fact ]
133
91
public void CanResetTheIndexToASubsetOfTheContentOfACommitWithCommitAsArgumentAndLaxUnmatchedExplicitPathsValidation ( )
134
92
{
135
93
string path = SandboxStandardTestRepo ( ) ;
136
94
using ( var repo = new Repository ( path ) )
137
95
{
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" } ,
139
97
new ExplicitPathsOptions { ShouldFailOnUnmatchedPath = false } ) ;
140
98
141
99
Assert . Equal ( "a8233120f6ad708f843d861ce2b7228ec4e3dec6" , repo . Index [ "README" ] . Id . Sha ) ;
@@ -149,7 +107,7 @@ public void ResettingTheIndexToASubsetOfTheContentOfACommitWithCommitAsArgumentA
149
107
using ( var repo = new Repository ( SandboxStandardTestRepo ( ) ) )
150
108
{
151
109
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 ( ) ) ) ;
153
111
}
154
112
}
155
113
@@ -159,7 +117,7 @@ public void CanResetTheIndexWhenARenameExists()
159
117
using ( var repo = new Repository ( SandboxStandardTestRepo ( ) ) )
160
118
{
161
119
repo . Move ( "branch_file.txt" , "renamed_branch_file.txt" ) ;
162
- repo . Reset ( repo . Lookup < Commit > ( "32eab9c" ) ) ;
120
+ repo . Index . Replace ( repo . Lookup < Commit > ( "32eab9c" ) ) ;
163
121
164
122
RepositoryStatus status = repo . RetrieveStatus ( ) ;
165
123
Assert . Equal ( 0 , status . Where ( IsStaged ) . Count ( ) ) ;
@@ -178,7 +136,7 @@ public void CanResetSourceOfARenameInIndex()
178
136
Assert . Equal ( FileStatus . Nonexistent , oldStatus [ "branch_file.txt" ] . State ) ;
179
137
Assert . Equal ( FileStatus . RenamedInIndex , oldStatus [ "renamed_branch_file.txt" ] . State ) ;
180
138
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" } ) ;
182
140
183
141
RepositoryStatus newStatus = repo . RetrieveStatus ( ) ;
184
142
Assert . Equal ( 0 , newStatus . RenamedInIndex . Count ( ) ) ;
@@ -198,7 +156,7 @@ public void CanResetTargetOfARenameInIndex()
198
156
Assert . Equal ( 1 , oldStatus . RenamedInIndex . Count ( ) ) ;
199
157
Assert . Equal ( FileStatus . RenamedInIndex , oldStatus [ "renamed_branch_file.txt" ] . State ) ;
200
158
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" } ) ;
202
160
203
161
RepositoryStatus newStatus = repo . RetrieveStatus ( ) ;
204
162
Assert . Equal ( 0 , newStatus . RenamedInIndex . Count ( ) ) ;
0 commit comments