Use repository format from exactly the same repository we want to fetch from.
Simply looking for all occurrences of repo.fetch() in this apply method shows that there are only two possible source repositories, one from local_branch and one from referenced_branch. If we will later fetch from either of these, we also use the corresponding format. If not, we fall back to default format. I don't know if this ever happens. The code is pretty verbose, making it easy to replace parts of the logic and keep other parts.