@@ -81,5 +81,32 @@ public void CanCheckIfAPathIsIgnoredUsingThePreferedPlatformDirectorySeparatorCh
81
81
Assert . True ( repo . Ignore . IsPathIgnored ( string . Format ( @"NewFolder{0}NewFolder{0}File.txt" , Path . DirectorySeparatorChar ) ) ) ;
82
82
}
83
83
}
84
+
85
+ [ Fact ]
86
+ public void HonorThePlatformPathSeparatorCharInTheGitIgnoreFile ( )
87
+ {
88
+ string path = InitNewRepository ( ) ;
89
+ using ( var repo = new Repository ( path ) )
90
+ {
91
+ Touch ( repo . Info . WorkingDirectory , ".gitignore" , string . Format ( "{0}fixes{1}Fixes.zip{1}" ,
92
+ Path . DirectorySeparatorChar , Environment . NewLine ) ) ;
93
+ Touch ( repo . Info . WorkingDirectory , "fixes/one" , "one{1}" ) ;
94
+ Touch ( repo . Info . WorkingDirectory , "fixes/two" , "two{1}" ) ;
95
+ Touch ( repo . Info . WorkingDirectory , "Fixes.zip" , "three{1}" ) ;
96
+ Touch ( repo . Info . WorkingDirectory , "Hello.txt" , "world{1}" ) ;
97
+
98
+ Assert . False ( repo . Ignore . IsPathIgnored ( "Hello.txt" ) ) ;
99
+ Assert . True ( repo . Ignore . IsPathIgnored ( "fixes" ) ) ;
100
+ Assert . True ( repo . Ignore . IsPathIgnored ( string . Format ( @"fixes{0}one" , Path . DirectorySeparatorChar ) ) ) ;
101
+ Assert . True ( repo . Ignore . IsPathIgnored ( "Fixes.zip" ) ) ;
102
+
103
+ var status = repo . RetrieveStatus ( ) ;
104
+
105
+ Assert . Equal ( new [ ] { "Fixes.zip" , string . Format ( "fixes{0}" , Path . DirectorySeparatorChar ) } ,
106
+ status . Ignored . Select ( se => se . FilePath ) ) ;
107
+ Assert . Equal ( new [ ] { ".gitignore" , "Hello.txt" } ,
108
+ status . Untracked . Select ( se => se . FilePath ) ) ;
109
+ }
110
+ }
84
111
}
85
112
}
0 commit comments