@@ -31,7 +31,7 @@ public override Task<bool> Sure()
31
31
watch . Start ( ) ;
32
32
33
33
var rootDir = new DirectoryInfo ( RootDir ) ;
34
- var found = new List < FoundRepository > ( ) ;
34
+ var found = new List < string > ( ) ;
35
35
GetUnmanagedRepositories ( rootDir , found , new EnumerationOptions ( )
36
36
{
37
37
AttributesToSkip = FileAttributes . Hidden | FileAttributes . System ,
@@ -50,20 +50,21 @@ public override Task<bool> Sure()
50
50
51
51
foreach ( var f in found )
52
52
{
53
- var parent = new DirectoryInfo ( f . Path ) . Parent ! . FullName . Replace ( '\\ ' , '/' ) . TrimEnd ( '/' ) ;
53
+ var parent = new DirectoryInfo ( f ) . Parent ! . FullName . Replace ( '\\ ' , '/' ) . TrimEnd ( '/' ) ;
54
54
if ( parent . Equals ( normalizedRoot , StringComparison . Ordinal ) )
55
55
{
56
- Preferences . Instance . FindOrAddNodeByRepositoryPath ( f . Path , null , false , false ) ;
56
+ Preferences . Instance . FindOrAddNodeByRepositoryPath ( f , null , false , false ) ;
57
57
}
58
58
else if ( parent . StartsWith ( normalizedRoot , StringComparison . Ordinal ) )
59
59
{
60
60
var relative = parent . Substring ( normalizedRoot . Length ) . TrimStart ( '/' ) ;
61
61
var group = FindOrCreateGroupRecursive ( Preferences . Instance . RepositoryNodes , relative ) ;
62
- Preferences . Instance . FindOrAddNodeByRepositoryPath ( f . Path , group , false , false ) ;
62
+ Preferences . Instance . FindOrAddNodeByRepositoryPath ( f , group , false , false ) ;
63
63
}
64
64
}
65
65
66
66
Preferences . Instance . AutoRemoveInvalidNode ( ) ;
67
+ Preferences . Instance . SortNodes ( Preferences . Instance . RepositoryNodes ) ;
67
68
Preferences . Instance . Save ( ) ;
68
69
69
70
Welcome . Instance . Refresh ( ) ;
@@ -84,7 +85,7 @@ private void GetManagedRepositories(List<RepositoryNode> group, HashSet<string>
84
85
}
85
86
}
86
87
87
- private void GetUnmanagedRepositories ( DirectoryInfo dir , List < FoundRepository > outs , EnumerationOptions opts , int depth = 0 )
88
+ private void GetUnmanagedRepositories ( DirectoryInfo dir , List < string > outs , EnumerationOptions opts , int depth = 0 )
88
89
{
89
90
var subdirs = dir . GetDirectories ( "*" , opts ) ;
90
91
foreach ( var subdir in subdirs )
@@ -107,7 +108,7 @@ private void GetUnmanagedRepositories(DirectoryInfo dir, List<FoundRepository> o
107
108
{
108
109
var normalized = test . StdOut . Trim ( ) . Replace ( '\\ ' , '/' ) . TrimEnd ( '/' ) ;
109
110
if ( ! _managed . Contains ( normalized ) )
110
- outs . Add ( new FoundRepository ( normalized , false ) ) ;
111
+ outs . Add ( normalized ) ;
111
112
}
112
113
113
114
continue ;
@@ -116,7 +117,7 @@ private void GetUnmanagedRepositories(DirectoryInfo dir, List<FoundRepository> o
116
117
var isBare = new Commands . IsBareRepository ( subdir . FullName ) . Result ( ) ;
117
118
if ( isBare )
118
119
{
119
- outs . Add ( new FoundRepository ( normalizedSelf , true ) ) ;
120
+ outs . Add ( normalizedSelf ) ;
120
121
continue ;
121
122
}
122
123
@@ -158,12 +159,6 @@ private RepositoryNode FindOrCreateGroup(List<RepositoryNode> collection, string
158
159
return added ;
159
160
}
160
161
161
- private record FoundRepository ( string path , bool isBare )
162
- {
163
- public string Path { get ; set ; } = path ;
164
- public bool IsBare { get ; set ; } = isBare ;
165
- }
166
-
167
- private HashSet < string > _managed = new HashSet < string > ( ) ;
162
+ private HashSet < string > _managed = new ( ) ;
168
163
}
169
164
}
0 commit comments