@@ -83,5 +83,39 @@ public void CanCheckIfAPathIsIgnoredUsingThePreferedPlatformDirectorySeparatorCh
83
83
Assert . True ( repo . Ignore . IsPathIgnored ( string . Format ( @"NewFolder{0}NewFolder{0}File.txt" , Path . DirectorySeparatorChar ) ) ) ;
84
84
}
85
85
}
86
+
87
+ [ Fact ]
88
+ public void HonorDeeplyNestedGitIgnoreFile ( )
89
+ {
90
+ string path = InitNewRepository ( ) ;
91
+ using ( var repo = new Repository ( path ) )
92
+ {
93
+ char pd = Path . DirectorySeparatorChar ;
94
+
95
+ var gitIgnoreFile = string . Format ( "deeply{0}nested{0}.gitignore" , pd ) ;
96
+ Touch ( repo . Info . WorkingDirectory , gitIgnoreFile , "SmtCounters.h" ) ;
97
+
98
+ repo . Stage ( gitIgnoreFile ) ;
99
+ repo . Commit ( "Add .gitignore" , Constants . Signature , Constants . Signature ) ;
100
+
101
+ Assert . False ( repo . RetrieveStatus ( ) . IsDirty ) ;
102
+
103
+ var ignoredFile = string . Format ( "deeply{0}nested{0}SmtCounters.h" , pd ) ;
104
+ Touch ( repo . Info . WorkingDirectory , ignoredFile , "Content" ) ;
105
+ Assert . False ( repo . RetrieveStatus ( ) . IsDirty ) ;
106
+
107
+ var file = string . Format ( "deeply{0}nested{0}file.txt" , pd ) ;
108
+ Touch ( repo . Info . WorkingDirectory , file , "Yeah!" ) ;
109
+
110
+ var repositoryStatus = repo . RetrieveStatus ( ) ;
111
+ Assert . True ( repositoryStatus . IsDirty ) ;
112
+
113
+ Assert . Equal ( FileStatus . Ignored , repositoryStatus [ ignoredFile ] . State ) ;
114
+ Assert . Equal ( FileStatus . NewInWorkdir , repositoryStatus [ file ] . State ) ;
115
+
116
+ Assert . True ( repo . Ignore . IsPathIgnored ( ignoredFile ) ) ;
117
+ Assert . False ( repo . Ignore . IsPathIgnored ( file ) ) ;
118
+ }
119
+ }
86
120
}
87
121
}
0 commit comments