diff --git a/config/patches/gitlab-rails/backup_read_REVISION.patch b/config/patches/gitlab-rails/backup_read_REVISION.patch new file mode 100644 index 0000000..333ef17 --- /dev/null +++ b/config/patches/gitlab-rails/backup_read_REVISION.patch @@ -0,0 +1,22 @@ +diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb +index efaefa4..8f0e38f 100644 +--- a/lib/backup/manager.rb ++++ b/lib/backup/manager.rb +@@ -7,7 +7,7 @@ module Backup + s = {} + s[:db_version] = "#{ActiveRecord::Migrator.current_version}" + s[:backup_created_at] = Time.now +- s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"") ++ s[:gitlab_version] = File.read(Rails.root.join('REVISION')).chomp + s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"") + + Dir.chdir(Gitlab.config.backup.path) +@@ -92,7 +92,7 @@ module Backup + 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] != File.read(Rails.root.join('REVISION')).chomp + 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 diff --git a/config/software/gitlab-rails.rb b/config/software/gitlab-rails.rb index c351c6c..b5c4c2e 100644 --- a/config/software/gitlab-rails.rb +++ b/config/software/gitlab-rails.rb @@ -43,6 +43,8 @@ build do # source code to include the Git revision of the code included in the omnibus # build. command "sed -i \"s/.*REVISION.*/REVISION = '$(git log --pretty=format:'%h' -n 1)'/\" config/initializers/2_app.rb" + patch :source => "backup_read_REVISION.patch" + command "git rev-parse HEAD > REVISION" bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem", :env => env -- libgit2 0.21.2