Skip to content

Commit f121873

Browse files
submodules are now nested
1 parent 40e3d8e commit f121873

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Model/PBGitSubmodule.h

+5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ typedef enum {
2121
NSString *checkedOutCommit;
2222

2323
PBGitSubmoduleState submoduleState;
24+
25+
NSMutableArray *submodules;
2426
}
27+
@property (nonatomic, retain, readonly) NSMutableArray *submodules;
2528
@property (nonatomic, assign, readonly) PBGitSubmoduleState submoduleState;
2629
@property (nonatomic, retain, readonly) NSString *name;
2730
@property (nonatomic, retain, readonly) NSString *path;
@@ -31,4 +34,6 @@ typedef enum {
3134

3235
+ (NSImage *) imageForSubmoduleState:(PBGitSubmoduleState) state;
3336
+ (PBGitSubmoduleState) submoduleStateFromCharacter:(unichar) character;
37+
38+
- (void) addSubmodule:(PBGitSubmodule *) submodule;
3439
@end

Model/PBGitSubmodule.m

+13
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ @implementation PBGitSubmodule
2020
@synthesize path;
2121
@synthesize checkedOutCommit;
2222
@synthesize submoduleState;
23+
@synthesize submodules;
24+
25+
- (NSMutableArray *) submodules {
26+
if (!submodules) {
27+
submodules = [[NSMutableArray alloc] init];
28+
}
29+
return submodules;
30+
}
2331

2432
- (id) initWithRawSubmoduleStatusString:(NSString *) submoduleStatusString {
2533
NSParameterAssert([submoduleStatusString length] > 0);
@@ -51,12 +59,17 @@ - (id) initWithRawSubmoduleStatusString:(NSString *) submoduleStatusString {
5159
}
5260

5361
- (void) dealloc {
62+
[submodules release];
5463
[name release];
5564
[path release];
5665
[checkedOutCommit release];
5766
[super dealloc];
5867
}
5968

69+
- (void) addSubmodule:(PBGitSubmodule *) submodule {
70+
[self.submodules addObject:submodule];
71+
}
72+
6073
#pragma mark -
6174
#pragma mark Presentable
6275

0 commit comments

Comments
 (0)