From fa340595746ba18fae3c6422ff4c9ea4af8e3023 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 22 Mar 2014 15:36:54 -0400 Subject: [PATCH 1/2] Default message for SatelliteNotExistError --- lib/gitlab/satellite/satellite.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb index bcf3012bd9..9e3c3997e5 100644 --- a/lib/gitlab/satellite/satellite.rb +++ b/lib/gitlab/satellite/satellite.rb @@ -1,5 +1,9 @@ module Gitlab - class SatelliteNotExistError < StandardError; end + class SatelliteNotExistError < StandardError + def initialize(msg = "Satellite doesn't exist") + super + end + end module Satellite class Satellite @@ -17,12 +21,8 @@ module Gitlab Gitlab::Satellite::Logger.error(message) end - def raise_no_satellite - raise SatelliteNotExistError.new("Satellite doesn't exist") - end - def clear_and_update! - raise_no_satellite unless exists? + raise SatelliteNotExistError unless exists? File.exists? path @repo = nil @@ -55,7 +55,7 @@ module Gitlab # * Changes the current directory to the satellite's working dir # * Yields def lock - raise_no_satellite unless exists? + raise SatelliteNotExistError unless exists? File.open(lock_file, "w+") do |f| begin @@ -77,7 +77,7 @@ module Gitlab end def repo - raise_no_satellite unless exists? + raise SatelliteNotExistError unless exists? @repo ||= Grit::Repo.new(path) end From 760f827ba0257d6664f429a832d1962fcac6e58e Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 22 Mar 2014 15:40:42 -0400 Subject: [PATCH 2/2] Remove code that does nothing ping @karlhungus --- lib/gitlab/satellite/satellite.rb | 1 - spec/support/test_env.rb | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb index 9e3c3997e5..bdfcf254e9 100644 --- a/lib/gitlab/satellite/satellite.rb +++ b/lib/gitlab/satellite/satellite.rb @@ -24,7 +24,6 @@ module Gitlab def clear_and_update! raise SatelliteNotExistError unless exists? - File.exists? path @repo = nil clear_working_dir! delete_heads! diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index e2c3f648cc..d00decf612 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -29,7 +29,6 @@ module TestEnv disable_mailer if opts[:mailer] == false setup_stubs - clear_test_repo_dir if opts[:init_repos] == true setup_test_repos(opts) if opts[:repos] == true end @@ -165,8 +164,7 @@ module TestEnv def clear_test_repo_dir setup_stubs - # Use tmp dir for FS manipulations - repos_path = testing_path() + # Remove tmp/test-git-base-path FileUtils.rm_rf Gitlab.config.gitlab_shell.repos_path