Ensure all refs are restored on a restore from backup

To restore all refs from a bundle, we need to use the --mirror option to
ensure that all refs are properly restored. Without this, refs such as
`refs/merge-requests/X` and `refs/keep-around/Y` would be omitted, which
exposed a bug as described in https://gitlab.com/gitlab-org/gitlab-ce/issues/38319#note_41648608.

Closes #38352
This commit is contained in:
Stan Hu 2017-09-29 15:10:36 -07:00
parent 171714c923
commit f3f304dc06
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
title: Ensure all refs are restored on a restore from backup
merge_request:
author:
type: fixed

View File

@ -78,7 +78,7 @@ module Backup
project.ensure_storage_path_exists
cmd = if File.exist?(path_to_project_bundle)
%W(#{Gitlab.config.git.bin_path} clone --bare #{path_to_project_bundle} #{path_to_project_repo})
%W(#{Gitlab.config.git.bin_path} clone --bare --mirror #{path_to_project_bundle} #{path_to_project_repo})
else
%W(#{Gitlab.config.git.bin_path} init --bare #{path_to_project_repo})
end