From 892a620737960d3f0ec6914b5739c60fdc8dd9b4 Mon Sep 17 00:00:00 2001
From: Monty Taylor <mordred@inaugust.com>
Date: Thu, 2 Aug 2012 10:54:21 -0500
Subject: [PATCH] Have apache honor replicate_local.

Change-Id: I44538a151afda2086469d0309b8113be0a477f93
---
 modules/gerrit/templates/gerrit.vhost.erb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/gerrit/templates/gerrit.vhost.erb b/modules/gerrit/templates/gerrit.vhost.erb
index 86a836ab75..b978ddce3e 100644
--- a/modules/gerrit/templates/gerrit.vhost.erb
+++ b/modules/gerrit/templates/gerrit.vhost.erb
@@ -43,17 +43,21 @@
   RewriteEngine on
   RewriteCond %{HTTP_HOST} !<%= scope.lookupvar("gerrit::virtual_hostname") %>
   RewriteRule ^.*$ <%= scope.lookupvar("gerrit::canonicalweburl") %>
+<% if scope.lookupvar("gerrit::replicate_local") -%>
   RewriteCond %{REQUEST_URI} !^/p/
+<% end -%>
   RewriteRule ^/(.*)$ http://localhost:8081/$1 [P]
 
   ProxyPassReverse / http://localhost:8081/
 
+<% if scope.lookupvar("gerrit::replicate_local") -%>
   SetEnv GIT_PROJECT_ROOT /var/lib/git/
   SetEnv GIT_HTTP_EXPORT_ALL
 
   AliasMatch ^/p/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/lib/git/$1
   AliasMatch ^/p/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/lib/git/$1
   ScriptAlias /p/ /usr/lib/git-core/git-http-backend/
+<% end -%>
 
   <Directory /home/gerrit2/review_site/git/>
     Order allow,deny