From 555fd0cf4ab9474f84b3fcf4a4045fdac181b5f7 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 23 Jun 2015 05:30:21 -0700 Subject: Fix downloading of patches on public merge requests when user logged out Closes #1225 Closes #1854 Closes #1858 --- lib/gitlab/backend/shell_env.rb | 4 +++- lib/gitlab/satellite/action.rb | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/gitlab/backend/shell_env.rb b/lib/gitlab/backend/shell_env.rb index 044afb27f3f..17ec029eed4 100644 --- a/lib/gitlab/backend/shell_env.rb +++ b/lib/gitlab/backend/shell_env.rb @@ -6,7 +6,9 @@ module Gitlab def set_env(user) # Set GL_ID env variable - ENV['GL_ID'] = "user-#{user.id}" + if user + ENV['GL_ID'] = "user-#{user.id}" + end end def reset_env diff --git a/lib/gitlab/satellite/action.rb b/lib/gitlab/satellite/action.rb index 4890ccf21e6..489070f1a3f 100644 --- a/lib/gitlab/satellite/action.rb +++ b/lib/gitlab/satellite/action.rb @@ -39,8 +39,10 @@ module Gitlab def prepare_satellite!(repo) project.satellite.clear_and_update! - repo.config['user.name'] = user.name - repo.config['user.email'] = user.email + if user + repo.config['user.name'] = user.name + repo.config['user.email'] = user.email + end end def default_options(options = {}) -- cgit v1.2.3