File tree 1 file changed +23
-0
lines changed 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,29 @@ public void CanStageANewFileWithARelativePathContainingNativeDirectorySeparatorC
264
264
}
265
265
}
266
266
267
+ [ Fact ]
268
+ public void CanStageAndUnstageAnIgnoredFile ( )
269
+ {
270
+ TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoWorkingDirPath ) ;
271
+ using ( var repo = new Repository ( path . RepositoryPath ) )
272
+ {
273
+ string gitignorePath = Path . Combine ( repo . Info . WorkingDirectory , ".gitignore" ) ;
274
+ File . WriteAllText ( gitignorePath , "*.ign" + Environment . NewLine ) ;
275
+
276
+ const string relativePath = "Champa.ign" ;
277
+ string gitignoredFile = Path . Combine ( repo . Info . WorkingDirectory , relativePath ) ;
278
+ File . WriteAllText ( gitignoredFile , "On stage!" + Environment . NewLine ) ;
279
+
280
+ Assert . Equal ( FileStatus . Ignored , repo . Index . RetrieveStatus ( relativePath ) ) ;
281
+
282
+ repo . Index . Stage ( relativePath ) ;
283
+ Assert . Equal ( FileStatus . Added , repo . Index . RetrieveStatus ( relativePath ) ) ;
284
+
285
+ repo . Index . Unstage ( relativePath ) ;
286
+ Assert . Equal ( FileStatus . Ignored , repo . Index . RetrieveStatus ( relativePath ) ) ;
287
+ }
288
+ }
289
+
267
290
[ Fact ]
268
291
public void StagingANewFileWithAFullPathWhichEscapesOutOfTheWorkingDirThrows ( )
269
292
{
You can’t perform that action at this time.
0 commit comments