File tree 2 files changed +19
-1
lines changed 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 3
3
using System . Linq ;
4
4
using LibGit2Sharp . Tests . TestHelpers ;
5
5
using Xunit ;
6
+ using Xunit . Extensions ;
6
7
7
8
namespace LibGit2Sharp . Tests
8
9
{
@@ -66,5 +67,22 @@ public void AddingATemporaryRuleWithBadParamsThrows()
66
67
Assert . Throws < ArgumentNullException > ( ( ) => repo . Ignore . AddTemporaryRules ( null ) ) ;
67
68
}
68
69
}
70
+
71
+ [ Fact ]
72
+ public void CanCheckIfAPathIsIgnoredUsingThePreferedPlatformDirectorySeparatorChar ( )
73
+ {
74
+ TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoWorkingDirPath ) ;
75
+
76
+ using ( var repo = new Repository ( path . RepositoryPath ) )
77
+ {
78
+ string ignorePath = Path . Combine ( repo . Info . WorkingDirectory , ".gitignore" ) ;
79
+ File . WriteAllText ( ignorePath , "/NewFolder\n /NewFolder/NewFolder" ) ;
80
+
81
+ Assert . False ( repo . Ignore . IsPathIgnored ( "File.txt" ) ) ;
82
+ Assert . True ( repo . Ignore . IsPathIgnored ( "NewFolder" ) ) ;
83
+ Assert . True ( repo . Ignore . IsPathIgnored ( string . Format ( @"NewFolder{0}NewFolder" , Path . DirectorySeparatorChar ) ) ) ;
84
+ Assert . True ( repo . Ignore . IsPathIgnored ( string . Format ( @"NewFolder{0}NewFolder{0}File.txt" , Path . DirectorySeparatorChar ) ) ) ;
85
+ }
86
+ }
69
87
}
70
88
}
Original file line number Diff line number Diff line change @@ -403,7 +403,7 @@ internal static extern int git_ignore_add_rule(
403
403
internal static extern int git_ignore_path_is_ignored (
404
404
out int ignored ,
405
405
RepositorySafeHandle repo ,
406
- [ MarshalAs ( UnmanagedType . CustomMarshaler , MarshalTypeRef = typeof ( Utf8Marshaler ) ) ] string path ) ;
406
+ [ MarshalAs ( UnmanagedType . CustomMarshaler , MarshalTypeRef = typeof ( FilePathMarshaler ) ) ] FilePath path ) ;
407
407
408
408
[ DllImport ( libgit2 ) ]
409
409
internal static extern int git_index_add_bypath (
You can’t perform that action at this time.
0 commit comments