11using System ;
22using System . Collections . Generic ;
3+ using System . Globalization ;
34using System . IO ;
45using System . Threading . Tasks ;
56
@@ -95,12 +96,12 @@ public override async Task<bool> Sure()
9596 foreach ( var f in found )
9697 {
9798 var parent = new DirectoryInfo ( f ) . Parent ! . FullName . Replace ( '\\ ' , '/' ) . TrimEnd ( '/' ) ;
98- if ( parent . Equals ( normalizedRoot , StringComparison . Ordinal ) )
99+ if ( parent . Equals ( normalizedRoot , StringComparison . OrdinalIgnoreCase ) )
99100 {
100101 var node = Preferences . Instance . FindOrAddNodeByRepositoryPath ( f , null , false , false ) ;
101102 await node . UpdateStatusAsync ( false , null ) ;
102103 }
103- else if ( parent . StartsWith ( normalizedRoot , StringComparison . Ordinal ) )
104+ else if ( parent . StartsWith ( normalizedRoot , StringComparison . OrdinalIgnoreCase ) )
104105 {
105106 var relative = parent . Substring ( normalizedRoot . Length ) . TrimStart ( '/' ) ;
106107 var group = FindOrCreateGroupRecursive ( Preferences . Instance . RepositoryNodes , relative ) ;
@@ -120,7 +121,7 @@ private void GetManagedRepositories(List<RepositoryNode> group, HashSet<string>
120121 foreach ( var node in group )
121122 {
122123 if ( node . IsRepository )
123- repos . Add ( node . Id ) ;
124+ repos . Add ( OperatingSystem . IsLinux ( ) ? node . Id : node . Id . ToLower ( CultureInfo . CurrentCulture ) ) ;
124125 else
125126 GetManagedRepositories ( node . SubNodes , repos ) ;
126127 }
@@ -138,7 +139,7 @@ private async Task GetUnmanagedRepositoriesAsync(DirectoryInfo dir, List<string>
138139 ProgressDescription = $ "Scanning { subdir . FullName } ...";
139140
140141 var normalizedSelf = subdir . FullName . Replace ( '\\ ' , '/' ) . TrimEnd ( '/' ) ;
141- if ( _managed . Contains ( normalizedSelf ) )
142+ if ( IsManaged ( normalizedSelf ) )
142143 continue ;
143144
144145 var gitDir = Path . Combine ( subdir . FullName , ".git" ) ;
@@ -148,7 +149,7 @@ private async Task GetUnmanagedRepositoriesAsync(DirectoryInfo dir, List<string>
148149 if ( test . IsSuccess && ! string . IsNullOrEmpty ( test . StdOut ) )
149150 {
150151 var normalized = test . StdOut . Trim ( ) . Replace ( '\\ ' , '/' ) . TrimEnd ( '/' ) ;
151- if ( ! _managed . Contains ( normalized ) )
152+ if ( ! IsManaged ( normalized ) )
152153 outs . Add ( normalized ) ;
153154 }
154155
@@ -200,6 +201,14 @@ private RepositoryNode FindOrCreateGroup(List<RepositoryNode> collection, string
200201 return added ;
201202 }
202203
204+ private bool IsManaged ( string path )
205+ {
206+ if ( OperatingSystem . IsLinux ( ) )
207+ return _managed . Contains ( path ) ;
208+
209+ return _managed . Contains ( path . ToLower ( CultureInfo . CurrentCulture ) ) ;
210+ }
211+
203212 private HashSet < string > _managed = new ( ) ;
204213 private bool _useCustomDir = false ;
205214 private string _customDir = string . Empty ;
0 commit comments