Commit 5f4fea17 authored by Angus MacArthur's avatar Angus MacArthur

Correction to restore expected current directory

parent 9c82bca5
......@@ -91,16 +91,21 @@ namespace :gitlab do
ENV["VERSION"] = "#{settings[:db_version]}" if settings[:db_version].to_i > 0
# backups directory is not always sub of Rails root and able to execute the git rev-parse below
begin
Dir.chdir(Rails.root)
# restoring mismatching backups can lead to unexpected problems
if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/,"")
if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/, "")
puts "GitLab version mismatch:".red
puts " Your current HEAD differs from the HEAD in the backup!".red
puts " Please switch to the following revision and try again:".red
puts " revision: #{settings[:gitlab_version]}".red
exit 1
end
ensure
# chdir back to original intended dir
Dir.chdir(Gitlab.config.backup.path)
end
Rake::Task["gitlab:backup:db:restore"].invoke
Rake::Task["gitlab:backup:repo:restore"].invoke
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment