Ensure local branches are current when syncing remote mirrors

When pushing to a remote mirror, it may take some time to retrieve the
remote refs. Since local refs could have changed while waiting for the
remote refs, we wait until the remote refs have arrived before loading
the local branches.

This relates to
gitlab-com/gl-infra/delivery#914.
28 jobs for sh-remote-branch-load-first in 14 minutes and 47 seconds (queued for 3 seconds)
Status Job ID Name Coverage
  Build
passed #758305198
gitlab-org
build: [1.13, v2.26.2]

00:02:58

passed #758305199
gitlab-org
build: [1.13, v2.27.0]

00:02:57

passed #758305200
gitlab-org
build: [1.13, v2.28.0]

00:02:58

passed #758305201
gitlab-org
build: [1.14, v2.26.2]

00:02:50

passed #758305202
gitlab-org
build: [1.14, v2.27.0]

00:02:53

passed #758305203
gitlab-org
build: [1.14, v2.28.0]

00:02:53

passed #758305197
gitlab-org
danger-review

00:00:49

 
  Test
passed #758305207
gitlab-org
bundler-audit-dependency_scanning

00:00:22

passed #758305225
gitlab-org
code_navigation

00:01:52

passed #758305219
gitlab-org
cover

00:11:44

66.9%
passed #758305206
gitlab-org
gemnasium-dependency_scanning

00:00:19

passed #758305205
gitlab-org
gosec-sast

00:01:44

passed #758305204
gitlab-org
license_scanning

00:05:39

passed #758305222
gitlab-org
lint

00:05:34

passed #758305224
gitlab-org
objectinfo_fuzz_test

00:07:57

passed #758305220
gitlab-org
praefect_sql_connect

00:02:51

passed #758305221
gitlab-org
praefect_sql_test

00:03:34

passed #758305209
gitlab-org
proto

00:02:02

passed #758305210
gitlab-org
test: [1.13, v2.26.2, test]

00:09:16

passed #758305211
gitlab-org
test: [1.13, v2.27.0, test]

00:08:35

passed #758305212
gitlab-org
test: [1.13, v2.28.0, test]

00:07:27

passed #758305213
gitlab-org
test: [1.14, v2.26.2, test]

00:08:06

passed #758305218
gitlab-org
test: [1.14, v2.27.0, race-go]

00:09:14

passed #758305217
gitlab-org
test: [1.14, v2.27.0, test-with-praefect]

00:10:49

passed #758305216
gitlab-org
test: [1.14, v2.27.0, test-with-proxies]

00:02:17

passed #758305214
gitlab-org
test: [1.14, v2.27.0, test]

00:08:39

passed #758305215
gitlab-org
test: [1.14, v2.28.0, test]

00:08:56

passed #758305208
gitlab-org
verify

00:01:45