GitHub Importer failing when target_branch_sha doesn't exist in local repository
It's possible to have a target_branch_sha pointing to an object that no longer exists in the repository. As we currently don't try to fetch remote for target_branch_sha, the PR never gets imported.
See https://gitlab.zendesk.com/agent/tickets/67647 for more details
Steps to reproduce
- Create a PR from a fork
- Point the PR to a branch that is not merged into master
- Merge the PR
- Delete the branch and don't merge into master
- Run garbage collector into the repository
What is the current bug behavior?
In the import_error we get:
Object not found - no match for id (abc1234...)
What is the expected correct behavior?
Importer should fetch from remote even for target_branch.
Check if target_branch_sha exists, if not, fetch from