Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion GitUpKit/Core/GCCommit.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ - (NSArray*)lookupParentsForCommit:(GCCommit*)commit error:(NSError**)error {
NSMutableArray* array = [[NSMutableArray alloc] init];
for (unsigned int i = 0, count = git_commit_parentcount(commit.private); i < count; ++i) {
git_commit* gitCommit;
CALL_LIBGIT2_FUNCTION_RETURN(nil, git_commit_parent, &gitCommit, commit.private, i);
int status = git_commit_parent(&gitCommit, commit.private, i);
if (status == GIT_ENOTFOUND) {
XLOG_WARNING(@"Missing parent commit for %s in repository \"%@\"", git_oid_tostr_s(git_commit_id(commit.private)), self.repositoryPath);
continue;
}
CHECK_LIBGIT2_FUNCTION_CALL(return nil, status, == GIT_OK);
GCCommit* parentCommit = [[GCCommit alloc] initWithRepository:self commit:gitCommit];
[array addObject:parentCommit];
}
Expand Down
22 changes: 21 additions & 1 deletion GitUpKit/Core/GCHistory.m
Original file line number Diff line number Diff line change
Expand Up @@ -924,9 +924,18 @@ - (BOOL)_reloadHistory:(GCHistory*)history
if (status == GIT_ITEROVER) {
break;
}
if (status == GIT_ENOTFOUND) {
XLOG_WARNING(@"Missing commit encountered while walking history in \"%@\"", self.repositoryPath);
continue;
}
CHECK_LIBGIT2_FUNCTION_CALL(goto cleanup, status, == GIT_OK);
git_commit* walkCommit;
CALL_LIBGIT2_FUNCTION_GOTO(cleanup, git_commit_lookup, &walkCommit, self.private, &oid);
status = git_commit_lookup(&walkCommit, self.private, &oid);
if (status == GIT_ENOTFOUND) {
XLOG_WARNING(@"Missing commit %s from repository \"%@\"", git_oid_tostr_s(&oid), self.repositoryPath);
continue;
}
CHECK_LIBGIT2_FUNCTION_CALL(goto cleanup, status, == GIT_OK);
GCHistoryCommit* commit = [[GCHistoryCommit alloc] initWithRepository:self commit:walkCommit autoIncrementID:nextAutoIncrementID++];
[commits addObject:commit];
[commit release];
Expand Down Expand Up @@ -1224,6 +1233,11 @@ - (NSArray*)lookupCommitsForFile:(NSString*)path followRenames:(BOOL)follow erro
for (unsigned int i = 0, count = git_commit_parentcount(commit); i < count; ++i) {
git_commit* parentCommit;
status = git_commit_parent(&parentCommit, commit, i);
if (status == GIT_ENOTFOUND) {
XLOG_WARNING(@"Missing parent commit for %s in repository \"%@\"", git_oid_tostr_s(&oid), self.repositoryPath);
status = GIT_ITEROVER;
break;
}
if (status == GIT_OK) {
git_tree* parentTree;
status = git_commit_tree(&parentTree, parentCommit);
Expand Down Expand Up @@ -1265,7 +1279,13 @@ - (NSArray*)lookupCommitsForFile:(NSString*)path followRenames:(BOOL)follow erro
git_tree_free(tree);
}
git_commit_free(commit);
} else if (status == GIT_ENOTFOUND) {
XLOG_WARNING(@"Missing commit %s from repository \"%@\"", git_oid_tostr_s(&oid), self.repositoryPath);
status = GIT_OK;
}
} else if (status == GIT_ENOTFOUND) {
XLOG_WARNING(@"Missing commit encountered while walking file history in \"%@\"", self.repositoryPath);
status = GIT_OK;
}
if (status == GIT_ITEROVER) {
break;
Expand Down