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

Correction to restore expected current directory

parent 9c82bca5
...@@ -91,15 +91,20 @@ namespace :gitlab do ...@@ -91,15 +91,20 @@ namespace :gitlab do
ENV["VERSION"] = "#{settings[:db_version]}" if settings[:db_version].to_i > 0 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 # backups directory is not always sub of Rails root and able to execute the git rev-parse below
Dir.chdir(Rails.root) begin
Dir.chdir(Rails.root)
# restoring mismatching backups can lead to unexpected problems
if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/,"") # restoring mismatching backups can lead to unexpected problems
puts "GitLab version mismatch:".red if settings[:gitlab_version] != %x{git rev-parse HEAD}.gsub(/\n/, "")
puts " Your current HEAD differs from the HEAD in the backup!".red puts "GitLab version mismatch:".red
puts " Please switch to the following revision and try again:".red puts " Your current HEAD differs from the HEAD in the backup!".red
puts " revision: #{settings[:gitlab_version]}".red puts " Please switch to the following revision and try again:".red
exit 1 puts " revision: #{settings[:gitlab_version]}".red
exit 1
end
ensure
# chdir back to original intended dir
Dir.chdir(Gitlab.config.backup.path)
end end
Rake::Task["gitlab:backup:db:restore"].invoke Rake::Task["gitlab:backup:db: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