diff options
| author | Angus MacArthur <amacarthur@blackberry.com> | 2013-06-03 11:00:24 -0400 |
|---|---|---|
| committer | Angus MacArthur <amacarthur@blackberry.com> | 2013-06-03 11:00:24 -0400 |
| commit | 5f4fea17ad42d24f069d19d36853b7ea61ee66c8 (patch) | |
| tree | c1d7b7453fbea90dcffd9f2f4b7b6af72a3edfee /lib | |
| parent | 9c82bca5ee274d700ec3166d4521d4c6d2ff896c (diff) | |
| download | gitlab-ce-5f4fea17ad42d24f069d19d36853b7ea61ee66c8.tar.gz | |
Correction to restore expected current directory
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tasks/gitlab/backup.rake | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index 920d29a444e..d071938acb5 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -91,15 +91,20 @@ 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 - Dir.chdir(Rails.root) - - # restoring mismatching backups can lead to unexpected problems - 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 + begin + Dir.chdir(Rails.root) + + # restoring mismatching backups can lead to unexpected problems + 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 |
