From 6f7ccea6686d4cc6c6241bc4289c13ff04cc8557 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Mon, 4 Feb 2013 16:19:37 +0200
Subject: [PATCH] Fix satellites to use filesystem. Correct post-receive user
 finder

---
 app/workers/post_receive.rb       | 7 +++++--
 lib/gitlab/satellite/satellite.rb | 4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb
index 6d31c08fefc..17ccfae21ec 100644
--- a/app/workers/post_receive.rb
+++ b/app/workers/post_receive.rb
@@ -28,10 +28,13 @@ class PostReceive
            elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
              User.find_by_email(identifier)
            else
-             Key.find_by_identifier(identifier).try(:user)
+             User.find_by_username(identifier.strip)
            end
 
-    return false unless user
+    unless user
+      Gitlab::GitLogger.error("POST-RECEIVE: Triggered hook for non-existing user \"#{identifier} \"")
+      return false
+    end
 
     project.trigger_post_receive(oldrev, newrev, ref, user)
   end
diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb
index 95273a6d208..e7f7a7673b5 100644
--- a/lib/gitlab/satellite/satellite.rb
+++ b/lib/gitlab/satellite/satellite.rb
@@ -30,10 +30,10 @@ module Gitlab
       end
 
       def create
-        output, status = popen("git clone #{project.url_to_repo} #{path}",
+        output, status = popen("git clone #{project.repository.path_to_repo} #{path}",
                                Gitlab.config.satellites.path)
 
-        log("PID: #{project.id}: git clone #{project.url_to_repo} #{path}")
+        log("PID: #{project.id}: git clone #{project.repository.path_to_repo} #{path}")
         log("PID: #{project.id}: -> #{output}")
 
         if status.zero?
-- 
GitLab