File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -467,7 +467,31 @@ - (PBGitCommit *)commitForSHA:(NSString *)sha
467
467
if ([[commit sha ] isEqual: sha])
468
468
return commit;
469
469
470
- return nil ;
470
+ // The commit has not been loaded, but it may exist anyway
471
+ NSArray *args = [NSArray arrayWithObjects:
472
+ @" show" , sha,
473
+ @" --pretty=format:"
474
+ " %P%n " // parents
475
+ " %a N <%a E>%n " // author name
476
+ " %c N <%c E>%n " // committer name
477
+ " %c t%n " // commit date
478
+ " %s " , // subject
479
+ nil ];
480
+ int retValue = 1 ;
481
+ NSString *output = [self outputInWorkdirForArguments: args retValue: &retValue];
482
+
483
+ if ((retValue != 0 ) || [output hasPrefix: @" fatal:" ])
484
+ return nil ;
485
+
486
+ NSArray *lines = [output componentsSeparatedByString: @" \n " ];
487
+ PBGitCommit *commit = [PBGitCommit commitWithRepository: self andSha: sha];
488
+
489
+ commit.parents = [[lines objectAtIndex: 0 ] componentsSeparatedByString: @" " ];
490
+ commit.author = [lines objectAtIndex: 1 ];
491
+ commit.committer = [lines objectAtIndex: 2 ];
492
+ commit.timestamp = [[lines objectAtIndex: 3 ] intValue ];
493
+ commit.subject = [lines objectAtIndex: 4 ];
494
+ return commit;
471
495
}
472
496
473
497
- (BOOL )isOnSameBranch : (NSString *)branchSHA asSHA : (NSString *)testSHA
You can’t perform that action at this time.
0 commit comments