@@ -21,36 +21,37 @@ - (id) initWithRepository:(PBGitRepository *) repo {
21
21
22
22
23
23
- (void ) reload {
24
- NSArray *arguments = [NSArray arrayWithObjects: @" submodule" , @" status" , @" --recursive" , nil ];
25
- NSString *output = [repository outputInWorkdirForArguments: arguments];
26
- NSArray *lines = [output componentsSeparatedByString: @" \n " ];
27
-
28
- NSMutableArray *loadedSubmodules = [[NSMutableArray alloc ] initWithCapacity: [lines count ]];
29
-
30
- for (NSString *submoduleLine in lines) {
31
- if ([submoduleLine length ] == 0 )
32
- continue ;
33
- PBGitSubmodule *submodule = [[PBGitSubmodule alloc ] initWithRawSubmoduleStatusString: submoduleLine];
34
- if (submodule)
35
- [loadedSubmodules addObject: submodule];
36
- }
37
-
38
- NSMutableArray *groupedSubmodules = [[NSMutableArray alloc ] init ];
39
- for (PBGitSubmodule *submodule in loadedSubmodules) {
40
- BOOL added = NO ;
41
- for (PBGitSubmodule *addedItem in groupedSubmodules) {
42
- if ([[submodule path ] hasPrefix: [addedItem path ]]) {
43
- [addedItem addSubmodule: submodule];
44
- added = YES ;
45
- }
46
- }
47
- if (!added) {
48
- [groupedSubmodules addObject: submodule];
49
- }
50
- }
51
-
52
-
53
- submodules = loadedSubmodules;
24
+ dispatch_async (PBGetWorkQueue (), ^{
25
+ NSArray *arguments = [NSArray arrayWithObjects: @" submodule" , @" status" , @" --recursive" , nil ];
26
+ NSString *output = [repository outputInWorkdirForArguments: arguments];
27
+ NSArray *lines = [output componentsSeparatedByString: @" \n " ];
28
+
29
+ NSMutableArray *loadedSubmodules = [[NSMutableArray alloc ] initWithCapacity: [lines count ]];
30
+
31
+ for (NSString *submoduleLine in lines) {
32
+ if ([submoduleLine length ] == 0 )
33
+ continue ;
34
+ PBGitSubmodule *submodule = [[PBGitSubmodule alloc ] initWithRawSubmoduleStatusString: submoduleLine];
35
+ if (submodule)
36
+ [loadedSubmodules addObject: submodule];
37
+ }
38
+
39
+ NSMutableArray *groupedSubmodules = [[NSMutableArray alloc ] init ];
40
+ for (PBGitSubmodule *submodule in loadedSubmodules) {
41
+ BOOL added = NO ;
42
+ for (PBGitSubmodule *addedItem in groupedSubmodules) {
43
+ if ([[submodule path ] hasPrefix: [addedItem path ]]) {
44
+ [addedItem addSubmodule: submodule];
45
+ added = YES ;
46
+ }
47
+ }
48
+ if (!added) {
49
+ [groupedSubmodules addObject: submodule];
50
+ }
51
+ }
52
+
53
+ submodules = loadedSubmodules;
54
+ });
54
55
}
55
56
56
57
#pragma mark -
0 commit comments