Don't call `ensure_ref_fetched` when viewing MRs

This should be a very quick win. First, we should instrument MergeRequest#ensure_ref_fetched, to validate the below.

MergeRequest#ensure_ref_fetched is called when viewing an MR. When the ref is fetched, we store that in the DB, so this is very cheap. When it isn't, we have to hit git to fetch the ref, then update the DB.

We should never be updating this when viewing (except for legacy MRs)! We can do this when creating the MR (which won't save time for the user, because they have to wait for the POST to finish anyway), and also when updating in the RefreshService.

Related: https://gitlab.com/gitlab-org/gitlab-ce/issues/35914

Edited Oct 03, 2017 by Sean McGivern
Assignee Loading
Time tracking Loading