fetch_sources: implement retrying of fetch/checkout
Created by: craftyguy
Sometimes checkouts of a specific commit fail if the repo has not been synced to the git cache yet. This retries the fetch and checkout a few times until it either succeeds or gives up.