|
12 | 12 | #import "PBGitGrapher.h" |
13 | 13 | #import "PBGitRevSpecifier.h" |
14 | 14 | #import "PBGitBinary.h" |
| 15 | +#import "PBError.h" |
15 | 16 |
|
16 | 17 | #import <ObjectiveGit/ObjectiveGit.h> |
17 | 18 | #import "ObjectiveGit+PBCategories.h" |
@@ -169,23 +170,33 @@ - (void) setupEnumerator:(GTEnumerator*)enumerator |
169 | 170 |
|
170 | 171 | // Handle the rest of our (less obvious) parameters |
171 | 172 | for (NSString *param in parameters) { |
| 173 | + GTObject *obj = nil; |
172 | 174 | if ([param hasPrefix:@"--glob="]) { |
173 | 175 | success = [enumerator pushGlob:[param substringFromIndex:@"--glob=".length] error:&error]; |
174 | | - if (!success) { |
175 | | - NSLog(@"Failed to push glob %@: %@", param, error); |
176 | | - } |
| 176 | + } else if ([param isEqualToString:@"HEAD"]) { |
| 177 | + success = [enumerator pushHEAD:&error]; |
| 178 | + } else if ((obj = [repo lookUpObjectByRevParse:param error:&error])) { |
| 179 | + success = [enumerator pushSHA:obj.SHA error:&error]; |
177 | 180 | } else { |
178 | | - NSError *lookupError = nil; |
179 | | - GTObject *obj = [repo lookUpObjectByRevParse:param error:&lookupError]; |
180 | | - if (obj) { |
181 | | - success = [enumerator pushSHA:obj.SHA error:&error]; |
| 181 | + int gitError = git_revwalk_push_range(enumerator.git_revwalk, param.UTF8String); |
| 182 | + if (gitError != GIT_OK) { |
| 183 | + NSString *desc = [NSString stringWithFormat:@"Failed to push range"]; |
| 184 | + NSString *fail = [NSString stringWithFormat:@"The range %@ couldn't be pushed", param]; |
| 185 | + error = [NSError errorWithDomain:GTGitErrorDomain |
| 186 | + code:gitError |
| 187 | + userInfo:@{ |
| 188 | + NSLocalizedDescriptionKey: desc, |
| 189 | + NSLocalizedFailureReasonErrorKey: fail, |
| 190 | + }]; |
| 191 | + success = NO; |
182 | 192 | } else { |
183 | | - success = [enumerator pushGlob:param error:&error]; |
184 | | - } |
185 | | - if (!success) { |
186 | | - NSLog(@"Failed to push remaining parameter %@: %@", param, error); |
| 193 | + success = YES; |
187 | 194 | } |
188 | 195 | } |
| 196 | + |
| 197 | + if (!success) { |
| 198 | + NSLog(@"Failed to push remaining parameter %@: %@", param, error); |
| 199 | + } |
189 | 200 | } |
190 | 201 |
|
191 | 202 | } |
|
0 commit comments