File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 8989
9090// Clear all the entries from the index. This happens in memory. Changes can be
9191// written to the datastore by calling -write:.
92- - (void )clear ;
92+ //
93+ // error - The error if one ocurred.
94+ //
95+ // Returns whether the clear operation was successful.
96+ - (BOOL )clear : (NSError **)error ;
9397
9498// Get the entry at the given index.
9599//
Original file line number Diff line number Diff line change @@ -124,8 +124,13 @@ - (BOOL)refresh:(NSError **)error {
124124 return YES ;
125125}
126126
127- - (void )clear {
128- git_index_clear (self.git_index );
127+ - (BOOL )clear : (NSError **)error {
128+ int gitError = git_index_clear (self.git_index );
129+ if (gitError != GIT_OK) {
130+ if (error != NULL ) *error = [NSError git_errorFor: gitError description: @" Failed to clear index" ];
131+ return NO ;
132+ }
133+ return YES ;
129134}
130135
131136- (GTIndexEntry *)entryAtIndex : (NSUInteger )index {
Original file line number Diff line number Diff line change 3030});
3131
3232it (@" should clear all entries" , ^{
33- [index clear ];
33+ [index clear: NULL ];
3434 expect (index.entryCount ).to .equal (0 );
3535});
3636
You can’t perform that action at this time.
0 commit comments