Skip to content

Commit

Permalink
Ignore error when retrieving changed PR review files
Browse files Browse the repository at this point in the history
  • Loading branch information
delvh committed Oct 17, 2022
1 parent 11ac14c commit b27fe05
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion services/gitdiff/gitdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -1235,8 +1235,14 @@ func SyncAndGetUserSpecificDiff(ctx context.Context, userID int64, pull *issues_
}

changedFiles, err := gitRepo.GetFilesChangedBetween(review.CommitSHA, latestCommit)
// There are way too many possible errors.
// Examples are various git errors such as the commit the review was based on was gc'ed and hence doesn't exist anymore as well as unrecoverable errors where we should serve a 500 response
// Due to the current architecture and physical limitation of needing to compare explicit error messages, we can only choose one approach without the code getting ugly
// For SOME of the errors such as the gc'ed commit, it would be best to mark all files as changed
// But as that does not work for all potential errors, we simply mark all files as unchanged and drop the error which always works, even if not as good as possible
if err != nil {
return diff, err
changedFiles = []string{}
log.Error("Could not get changed files between %s and %s for pull request %d in repo with path %s. Assuming no changes. Error: %w", review.CommitSHA, latestCommit, pull.Index, gitRepo.Path, err)
}

filesChangedSinceLastDiff := make(map[string]pull_model.ViewedState)
Expand Down

0 comments on commit b27fe05

Please sign in to comment.