[Fusionforge-commits] FusionForge branch feature/concurrent-ssh-http-for-scm updated. ed7e99677d4bb447dcfcf0002f7e663c0f2d8834

Roland Mas lolando at fusionforge.org
Fri May 23 14:46:52 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, feature/concurrent-ssh-http-for-scm has been updated
       via  ed7e99677d4bb447dcfcf0002f7e663c0f2d8834 (commit)
       via  0e7ba9c7b369a1f07c029780ba228588f1e53207 (commit)
       via  8d5d0d0adbedde00fbf378805dc75fbc32fe8cf5 (commit)
       via  90231352b099dedc898ad1490839d4365960e015 (commit)
       via  c71d718ca686afe159a5a76d0e1a21090a8ff357 (commit)
       via  662be565ee047c4e65c67d9caba136cf87c965f5 (commit)
       via  800667b48a4c22f4cec1460ba8fe13df0dfa86b7 (commit)
       via  31ceaf4760b22b868cba29da5ea3c7346d952199 (commit)
      from  79155aa0931f68b0d0619e1f12abace19dcc1379 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ed7e99677d4bb447dcfcf0002f7e663c0f2d8834
Merge: 79155aa 0e7ba9c
Author: Roland Mas <lolando at debian.org>
Date:   Fri May 23 14:46:27 2014 +0200

    Merge branch 'feature/concurrent-ssh-http-for-scm-5.3' into feature/concurrent-ssh-http-for-scm


commit 0e7ba9c7b369a1f07c029780ba228588f1e53207
Author: Roland Mas <lolando at debian.org>
Date:   Fri May 23 14:16:43 2014 +0200

    Add alias to /etc/hosts for the scm.foo host

diff --git a/tests/scripts/fusionforge-build-and-test-deb.sh b/tests/scripts/fusionforge-build-and-test-deb.sh
index 0c5a305..3d6841d 100755
--- a/tests/scripts/fusionforge-build-and-test-deb.sh
+++ b/tests/scripts/fusionforge-build-and-test-deb.sh
@@ -156,6 +156,9 @@ HUDSON_URL=$HUDSON_URL
 JOB_NAME=$JOB_NAME
 EOF
 
+# Add alias to /etc/hosts
+ssh root@$HOST 'sed -i -e "s/^$(hostname -i).*/& $(forge_get_config scm_host)/" /etc/hosts'
+ 
 # Run tests
 retcode=0
 echo "Run phpunit test on $HOST in $FORGE_HOME"
diff --git a/tests/scripts/fusionforge-build-and-test-rpm.sh b/tests/scripts/fusionforge-build-and-test-rpm.sh
index 430fbf0..431fafc 100755
--- a/tests/scripts/fusionforge-build-and-test-rpm.sh
+++ b/tests/scripts/fusionforge-build-and-test-rpm.sh
@@ -82,6 +82,9 @@ HUDSON_URL=$HUDSON_URL
 JOB_NAME=$JOB_NAME
 EOF
 
+# Add alias to /etc/hosts
+ssh root@$HOST 'sed -i -e "s/^$(hostname -i).*/& $(forge_get_config scm_host)/" /etc/hosts'
+ 
 # Run tests
 retcode=0
 echo "Run phpunit test on $HOST in $FORGE_HOME"
diff --git a/tests/scripts/fusionforge-build-and-test-src-cos.sh b/tests/scripts/fusionforge-build-and-test-src-cos.sh
index c13f38c..94c2bef 100755
--- a/tests/scripts/fusionforge-build-and-test-src-cos.sh
+++ b/tests/scripts/fusionforge-build-and-test-src-cos.sh
@@ -75,6 +75,9 @@ HUDSON_URL=$HUDSON_URL
 JOB_NAME=$JOB_NAME
 EOF
 
+# Add alias to /etc/hosts
+ssh root@$HOST 'sed -i -e "s/^$(hostname -i).*/& $(forge_get_config scm_host)/" /etc/hosts'
+ 
 # Run tests
 retcode=0
 echo "Run phpunit test on $HOST in $FORGE_HOME"
diff --git a/tests/scripts/fusionforge-build-and-test-src-deb.sh b/tests/scripts/fusionforge-build-and-test-src-deb.sh
index b52f809..0d0cf3d 100755
--- a/tests/scripts/fusionforge-build-and-test-src-deb.sh
+++ b/tests/scripts/fusionforge-build-and-test-src-deb.sh
@@ -60,6 +60,9 @@ HUDSON_URL=$HUDSON_URL
 JOB_NAME=$JOB_NAME
 EOF
 
+# Add alias to /etc/hosts
+ssh root@$HOST 'sed -i -e "s/^$(hostname -i).*/& $(forge_get_config scm_host)/" /etc/hosts'
+ 
 # Run tests
 retcode=0
 echo "Run phpunit test on $HOST in $FORGE_HOME"

commit 8d5d0d0adbedde00fbf378805dc75fbc32fe8cf5
Author: Roland Mas <lolando at debian.org>
Date:   Mon May 5 15:24:43 2014 +0200

    Added machinery for Subversion read/write over WebDAV using mpm-itk for privilege separation

diff --git a/src/etc/httpd.conf.d/05-config-macros-scmsvn.conf b/src/etc/httpd.conf.d/05-config-macros-scmsvn.conf
new file mode 100644
index 0000000..e07f375
--- /dev/null
+++ b/src/etc/httpd.conf.d/05-config-macros-scmsvn.conf
@@ -0,0 +1,35 @@
+<Macro ScmsvnProjectWithAnon $project>
+<LocationMatch "^/svn/$project/">
+  DAV svn
+  SVNPath {scmsvn/repos_path}/$project
+  # allow read-only browsing
+  <LimitExcept GET PROPFIND OPTIONS REPORT>
+  </LimitExcept>
+</LocationMatch>
+
+# Use ScmsvnProjectWithoutAnon $project
+</Macro>
+
+<Macro ScmsvnProjectWithoutAnon $project>
+# <LocationMatch "^/authsvn/[^/]+/$project/">
+#   DAV svn
+#   SVNPath {scmsvn/repos_path}/$project
+#   AuthzSVNAccessFile {core/data_path}/svnroot-access
+# </LocationMatch>
+</Macro>
+
+<Macro ScmsvnUser $user>
+<Location /authsvn/$user>
+  DAV svn
+  SVNParentPath {scmsvn/repos_path}
+
+  # how to authenticate a user
+  AuthzSVNAccessFile {core/data_path}/svnroot-access
+  AuthType Basic
+  AuthName "SCM for {core/forge_name}"
+  AuthUserFile {core/data_path}/svnroot-authfile
+
+  # only authenticated users may access the repository
+  Require user $user
+</Location>
+</Macro>
diff --git a/src/etc/httpd.conf.d/plugin-scmsvn.inc b/src/etc/httpd.conf.d/plugin-scmsvn.inc
index 18541b2..6b9cd5f 100644
--- a/src/etc/httpd.conf.d/plugin-scmsvn.inc
+++ b/src/etc/httpd.conf.d/plugin-scmsvn.inc
@@ -1,4 +1,4 @@
-<Location /svn>
+<Location /foosvn>
   <IfModule mod_dav_svn.c>
     DAV svn
     SVNParentPath {scmsvn/repos_path}
@@ -20,3 +20,16 @@
     </IfModule>
   </IfModule>
 </Location>
+
+<LocationMatch "^/authsvn/">
+    <IfModule mod_authz_svn.c>
+      # how to authenticate a user
+      AuthzSVNAccessFile {core/data_path}/svnroot-access
+      AuthType Basic
+      AuthName "SCM for {core/forge_name}"
+      AuthUserFile {core/data_path}/svnroot-authfile
+
+      # only authenticated users may access the repository
+      Require valid-user
+    </IfModule>
+</LocationMatch>
diff --git a/src/etc/httpd.conf.d/vhost-scm-plugin-scmsvn.inc b/src/etc/httpd.conf.d/vhost-scm-plugin-scmsvn.inc
new file mode 100644
index 0000000..1925dd1
--- /dev/null
+++ b/src/etc/httpd.conf.d/vhost-scm-plugin-scmsvn.inc
@@ -0,0 +1,2 @@
+SetEnvIf Request_URI ^/authsvn/([^/]+)/ ITKUID=$1
+SetEnvIf Request_URI ^/authsvn/([^/]+)/([^/]+)/ ITKGID=$2
diff --git a/src/etc/httpd.conf.d/vhost-scm.inc b/src/etc/httpd.conf.d/vhost-scm.inc
index 7d88c20..d8d5e09 100644
--- a/src/etc/httpd.conf.d/vhost-scm.inc
+++ b/src/etc/httpd.conf.d/vhost-scm.inc
@@ -6,12 +6,12 @@ SetEnvIf Request_URI . ITKGID=www-data
 <IfVersion >= 2.3>
   IncludeOptional {core/config_path}/httpd.conf.d/plugin-scm*.inc
   IncludeOptional {core/config_path}/httpd.conf.d/vhost-scm-plugin-scm*.inc
-  IncludeOptional {core/data_path}/scmgit-auth*.inc
+  IncludeOptional {core/data_path}/scm*-auth*.inc
 </IfVersion>
 <IfVersion < 2.3>
   Include {core/config_path}/httpd.conf.d/plugin-scm*.inc
   Include {core/config_path}/httpd.conf.d/vhost-scm-plugin-scm*.inc
-  Include {core/data_path}/scmgit-auth*.inc
+  Include {core/data_path}/scm*-auth*.inc
 </IfVersion>
 
 AssignUserIDExpr %{reqenv:ITKUID}
diff --git a/src/plugins/scmgit/common/GitPlugin.class.php b/src/plugins/scmgit/common/GitPlugin.class.php
index 7000fcb..c9fec44 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -733,8 +733,6 @@ class GitPlugin extends SCMPlugin {
 			$group_fname = forge_get_config('data_path').'/scmgit-groupfile';
 			$group_f = fopen($group_fname.'.new', 'w');
 			
-			fwrite($config_f, '');
-			
 			foreach ($groups as $project) {
 				if ( !$project->isActive()) {
 					continue;
diff --git a/src/plugins/scmsvn/common/SVNPlugin.class.php b/src/plugins/scmsvn/common/SVNPlugin.class.php
index f67e06c..ec63674 100644
--- a/src/plugins/scmsvn/common/SVNPlugin.class.php
+++ b/src/plugins/scmsvn/common/SVNPlugin.class.php
@@ -153,7 +153,7 @@ class SVNPlugin extends SCMPlugin {
 				$b .= ' ';
 				$b .= _('Enter your site password when prompted.');
 				$b .= '</p>';
-				$b .= '<p><tt>svn checkout --username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. $this->getBoxForProject($project) . $this->svn_root_dav .'/'.$project->getUnixName().$module.'</tt></p>' ;
+				$b .= '<p><tt>svn checkout --username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. forge_get_config('scm_host'). '/authsvn/'.$d.'/'.$project->getUnixName().$module.'</tt></p>' ;
 			}
 		} else {
 			if (forge_get_config('use_ssh', 'scmsvn')) {
@@ -337,6 +337,9 @@ class SVNPlugin extends SCMPlugin {
 			return true;
 		}
 
+		$config_fname = forge_get_config('data_path').'/scmsvn-auth.inc';
+		$config_f = fopen($config_fname.'.new', 'w');
+			
 		$access_data = '';
 		$password_data = '';
 		$engine = RBACEngine::getInstance() ;
@@ -371,10 +374,22 @@ class SVNPlugin extends SCMPlugin {
 
 			$access_data .= "\n";
 			$engine->invalidateRoleCaches();  // caching all roles takes ~1GB RAM for 5K projects/15K users
+
+			if ($project->enableAnonSCM()) {
+				fwrite($config_f, 'Use ScmsvnProjectWithAnon '.$project->getUnixName().'
+');
+			} else {
+				fwrite($config_f, 'Use ScmsvnProjectWithoutAnon '.$project->getUnixName().'
+');
+			}
+			
+			fwrite($config_f, "\n");
 		}
 
 		foreach ($svnusers as $user_id => $user) {
 			$password_data .= $user->getUnixName().':'.$user->getUnixPasswd()."\n";
+			fwrite($config_f, 'Use ScmsvnUser '.$user->getUnixName().'
+');
 		}
 		$password_data .= forge_get_config('anonsvn_login', 'scmsvn').":".htpasswd_apr1_md5(forge_get_config('anonsvn_password', 'scmsvn'))."\n";
 
@@ -391,6 +406,10 @@ class SVNPlugin extends SCMPlugin {
 		fclose($f);
 		chmod($fname.'.new', 0644);
 		rename($fname.'.new', $fname);
+
+		fclose($config_f);
+		chmod($config_fname.'.new', 0644);
+		rename($config_fname.'.new', $config_fname);
 	}
 
 	function gatherStats($params) {
diff --git a/tests/func/PluginsScmSvn/svnWebDAVTest.php b/tests/func/PluginsScmSvn/svnWebDAVTest.php
new file mode 100644
index 0000000..b88373c
--- /dev/null
+++ b/tests/func/PluginsScmSvn/svnWebDAVTest.php
@@ -0,0 +1,90 @@
+<?php
+/*
+ * Copyright (C) 2012 Roland Mas
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *      
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */             
+
+require_once dirname(dirname(__FILE__)).'/Testing/SeleniumGforge.php';
+
+class ScmSvnWebDAVTest extends FForge_SeleniumTestCase
+{
+	function testScmSvnWebDAV()
+	{
+		$this->activatePlugin('scmsvn');
+		$this->populateStandardTemplate('empty');
+		$this->init();
+
+		$this->open(ROOT);
+		$this->clickAndWait("link=ProjectA");
+		$this->clickAndWait("link=Admin");
+		$this->clickAndWait("link=Tools");
+		$this->clickAndWait("link=Source Code Admin");
+		$this->click("//input[@name='scmradio' and @value='scmsvn']");
+		$this->clickAndWait("submit");
+	    
+		// Run the cronjob to create repositories
+		$this->cron("create_scm_repos.php");
+		$this->cron("homedirs.php");
+		$this->reload_apache();
+		$this->reload_nscd();
+
+		// Get the address of the repo
+		$this->open(ROOT);
+		$this->clickAndWait("link=ProjectA");
+		$this->clickAndWait("link=SCM");
+		$p = $this->getText("//tt[contains(.,'svn checkout --username ".FORGE_ADMIN_USERNAME." http')]");
+		$p = preg_replace(",^svn checkout --username ".FORGE_ADMIN_USERNAME." ,", "", $p);
+
+		// Create a local clone, add stuff, push it to the repo
+		$t = exec("mktemp -d /tmp/svnTest.XXXXXX");
+		$auth = "--username ".FORGE_ADMIN_USERNAME." --password ".FORGE_ADMIN_PASSWORD;
+		system("cd $t && svn checkout $auth $p projecta", $ret);
+		$this->assertEquals($ret, 0);
+
+		system("echo 'this is a simple text' > $t/projecta/mytext.txt");
+		system("cd $t/projecta && svn add mytext.txt && svn commit $auth -m'Adding file'", $ret);
+		system("echo 'another simple text' >> $t/projecta/mytext.txt");
+		system("cd $t/projecta && svn commit $auth -m'Modifying file'", $ret);
+		$this->assertEquals($ret, 0);
+
+		// Check that the changes appear in svnweb
+		$this->open(ROOT);
+		$this->clickAndWait("link=ProjectA");
+		$this->clickAndWait("link=SCM");
+		$this->clickAndWait("link=Browse Subversion Repository");
+		$this->assertTextPresent("Modifying file");
+		$this->assertTextNotPresent("Adding file");
+
+		system("rm -fr $t");
+	}
+
+	/**
+	 * Method that is called after Selenium actions.
+	 *
+	 * @param  string $action
+	 */
+	protected function defaultAssertions($action)
+	{
+		if ($action == 'waitForPageToLoad') {
+			$this->assertTrue($this->isElementPresent("//h1")
+					  || $this->isElementPresent("//.[@class='page_footer']"));
+		}
+	}
+
+}
+?>

commit 90231352b099dedc898ad1490839d4365960e015
Author: Roland Mas <lolando at debian.org>
Date:   Fri Apr 25 13:04:11 2014 +0200

    Testsuite for Git over smart HTTP

diff --git a/tests/func/PluginsScmGit/gitSmartHTTPTest.php b/tests/func/PluginsScmGit/gitSmartHTTPTest.php
index b85458b..211e591 100644
--- a/tests/func/PluginsScmGit/gitSmartHTTPTest.php
+++ b/tests/func/PluginsScmGit/gitSmartHTTPTest.php
@@ -39,14 +39,17 @@ class ScmGitSmartHTTPTest extends FForge_SeleniumTestCase
 	    
 		// Run the cronjob to create repositories
 		$this->cron("create_scm_repos.php");
+		$this->cron("homedirs.php");
+		$this->reload_apache();
+		$this->reload_nscd();
 
 		// Get the address of the repo
 		$this->open(ROOT);
 		$this->clickAndWait("link=ProjectA");
 		$this->clickAndWait("link=SCM");
-		$p = $this->getText("//tt[contains(.,'git clone http')]");
+		$p = $this->getText("//tt[contains(.,'git clone http') and contains(.,'".FORGE_ADMIN_USERNAME."@')]");
 		$p = preg_replace(",^git clone ,", "", $p);
-		$p = preg_replace(",://.*@,", "://root@", $p);
+		$p = preg_replace(",@,", ":".FORGE_ADMIN_PASSWORD."@", $p);
 
 		// Create a local clone, add stuff, push it to the repo
 		$t = exec("mktemp -d /tmp/gitTest.XXXXXX");

commit c71d718ca686afe159a5a76d0e1a21090a8ff357
Author: Roland Mas <lolando at debian.org>
Date:   Fri Apr 25 13:02:34 2014 +0200

    New testsuite methods to reload Apache and (u)nscd

diff --git a/tests/func/PluginsScmGit/gitSSHTest.php b/tests/func/PluginsScmGit/gitSSHTest.php
index 4dedac7..baca405 100644
--- a/tests/func/PluginsScmGit/gitSSHTest.php
+++ b/tests/func/PluginsScmGit/gitSSHTest.php
@@ -43,6 +43,7 @@ class ScmGitSSHTest extends FForge_SeleniumTestCase
 		$this->cron("create_scm_repos.php");
 		$this->cron("homedirs.php");
 		$this->cron("ssh_create.php");
+		$this->reload_nscd();
 
 		// Get the address of the repo
 		$this->open(ROOT);

commit 662be565ee047c4e65c67d9caba136cf87c965f5
Author: Roland Mas <lolando at debian.org>
Date:   Fri Apr 25 11:46:27 2014 +0200

    Use user account rather than root for git+ssh:// tests

diff --git a/tests/func/PluginsScmGit/gitSSHTest.php b/tests/func/PluginsScmGit/gitSSHTest.php
index ee976c6..4dedac7 100644
--- a/tests/func/PluginsScmGit/gitSSHTest.php
+++ b/tests/func/PluginsScmGit/gitSSHTest.php
@@ -36,9 +36,13 @@ class ScmGitSSHTest extends FForge_SeleniumTestCase
 		$this->clickAndWait("link=Source Code Admin");
 		$this->click("//input[@name='scmradio' and @value='scmgit']");
 		$this->clickAndWait("submit");
+
+		$this->uploadSshKey();
 	    
 		// Run the cronjob to create repositories
 		$this->cron("create_scm_repos.php");
+		$this->cron("homedirs.php");
+		$this->cron("ssh_create.php");
 
 		// Get the address of the repo
 		$this->open(ROOT);
@@ -46,7 +50,6 @@ class ScmGitSSHTest extends FForge_SeleniumTestCase
 		$this->clickAndWait("link=SCM");
 		$p = $this->getText("//tt[contains(.,'git clone git+ssh')]");
 		$p = preg_replace(",^git clone ,", "", $p);
-		$p = preg_replace(",://.*@,", "://root@", $p);
 
 		// Create a local clone, add stuff, push it to the repo
 		$t = exec("mktemp -d /tmp/gitTest.XXXXXX");

commit 800667b48a4c22f4cec1460ba8fe13df0dfa86b7
Author: Roland Mas <lolando at debian.org>
Date:   Thu Apr 24 16:18:37 2014 +0200

    Split scmgit testsuite into three parts

diff --git a/tests/func/PluginsScmGit/gitTest.php b/tests/func/PluginsScmGit/gitSSHTest.php
similarity index 61%
copy from tests/func/PluginsScmGit/gitTest.php
copy to tests/func/PluginsScmGit/gitSSHTest.php
index 5656f6d..ee976c6 100644
--- a/tests/func/PluginsScmGit/gitTest.php
+++ b/tests/func/PluginsScmGit/gitSSHTest.php
@@ -21,9 +21,9 @@
 
 require_once dirname(dirname(__FILE__)).'/Testing/SeleniumGforge.php';
 
-class ScmGitTest extends FForge_SeleniumTestCase
+class ScmGitSSHTest extends FForge_SeleniumTestCase
 {
-	function testScmGit()
+	function testScmGitSSH()
 	{
 		$this->activatePlugin('scmgit');
 		$this->populateStandardTemplate('empty');
@@ -37,51 +37,9 @@ class ScmGitTest extends FForge_SeleniumTestCase
 		$this->click("//input[@name='scmradio' and @value='scmgit']");
 		$this->clickAndWait("submit");
 	    
-		$this->type("//input[@name='repo_name']", "other-repo");
-		$this->type("//input[@name='description']", "Description for second repository");
-		$this->clickAndWait("//input[@value='Submit']");
-		$this->assertTextPresent("New repository other-repo registered");
-		
-		$this->open(ROOT);
-		$this->clickAndWait("link=ProjectA");
-		$this->clickAndWait("link=SCM");
-		$this->assertTextPresent("other-repo");
-
-		$this->assertTextPresent("Anonymous Access to the Git");
-		$this->clickAndWait("link=Request a personal repository");
-		$this->assertTextPresent("You have now requested a personal Git repository");
-
-		// Run the cronjob to create repositories
-		$this->cron("create_scm_repos.php");
-
-		$this->clickAndWait("link=SCM");
-		$this->assertTextPresent("Access to your personal repository");
-
-		$this->open(ROOT.'/plugins/scmgit/cgi-bin/gitweb.cgi?a=project_list;pf=projecta');
-		$this->waitForPageToLoad();
-		$this->assertElementPresent("//.[@class='page_footer']");
-		$this->assertTextPresent("projecta.git");
-		$this->assertTextPresent("other-repo.git");
-		$this->assertTextPresent("users/".FORGE_ADMIN_USERNAME.".git");
-
-		$this->open(ROOT);
-		$this->clickAndWait("link=ProjectA");
-		$this->clickAndWait("link=Admin");
-		$this->clickAndWait("link=Tools");
-		$this->clickAndWait("link=Source Code Admin");
-		$this->clickAndWait("//form[@name='form_delete_repo_other-repo']/input[@value='Delete']");
-		$this->assertTextPresent("Repository other-repo is marked for deletion");
-
 		// Run the cronjob to create repositories
 		$this->cron("create_scm_repos.php");
 
-		$this->open(ROOT.'/plugins/scmgit/cgi-bin/gitweb.cgi?a=project_list;pf=projecta');
-		$this->waitForPageToLoad();
-		$this->assertElementPresent("//.[@class='page_footer']");
-		$this->assertTextPresent("projecta.git");
-		$this->assertTextNotPresent("other-repo.git");
-		$this->assertTextPresent("users/".FORGE_ADMIN_USERNAME.".git");
-
 		// Get the address of the repo
 		$this->open(ROOT);
 		$this->clickAndWait("link=ProjectA");
diff --git a/tests/func/PluginsScmGit/gitTest.php b/tests/func/PluginsScmGit/gitSmartHTTPTest.php
similarity index 60%
copy from tests/func/PluginsScmGit/gitTest.php
copy to tests/func/PluginsScmGit/gitSmartHTTPTest.php
index 5656f6d..b85458b 100644
--- a/tests/func/PluginsScmGit/gitTest.php
+++ b/tests/func/PluginsScmGit/gitSmartHTTPTest.php
@@ -21,9 +21,9 @@
 
 require_once dirname(dirname(__FILE__)).'/Testing/SeleniumGforge.php';
 
-class ScmGitTest extends FForge_SeleniumTestCase
+class ScmGitSmartHTTPTest extends FForge_SeleniumTestCase
 {
-	function testScmGit()
+	function testScmGitSmartHTTP()
 	{
 		$this->activatePlugin('scmgit');
 		$this->populateStandardTemplate('empty');
@@ -37,56 +37,14 @@ class ScmGitTest extends FForge_SeleniumTestCase
 		$this->click("//input[@name='scmradio' and @value='scmgit']");
 		$this->clickAndWait("submit");
 	    
-		$this->type("//input[@name='repo_name']", "other-repo");
-		$this->type("//input[@name='description']", "Description for second repository");
-		$this->clickAndWait("//input[@value='Submit']");
-		$this->assertTextPresent("New repository other-repo registered");
-		
-		$this->open(ROOT);
-		$this->clickAndWait("link=ProjectA");
-		$this->clickAndWait("link=SCM");
-		$this->assertTextPresent("other-repo");
-
-		$this->assertTextPresent("Anonymous Access to the Git");
-		$this->clickAndWait("link=Request a personal repository");
-		$this->assertTextPresent("You have now requested a personal Git repository");
-
-		// Run the cronjob to create repositories
-		$this->cron("create_scm_repos.php");
-
-		$this->clickAndWait("link=SCM");
-		$this->assertTextPresent("Access to your personal repository");
-
-		$this->open(ROOT.'/plugins/scmgit/cgi-bin/gitweb.cgi?a=project_list;pf=projecta');
-		$this->waitForPageToLoad();
-		$this->assertElementPresent("//.[@class='page_footer']");
-		$this->assertTextPresent("projecta.git");
-		$this->assertTextPresent("other-repo.git");
-		$this->assertTextPresent("users/".FORGE_ADMIN_USERNAME.".git");
-
-		$this->open(ROOT);
-		$this->clickAndWait("link=ProjectA");
-		$this->clickAndWait("link=Admin");
-		$this->clickAndWait("link=Tools");
-		$this->clickAndWait("link=Source Code Admin");
-		$this->clickAndWait("//form[@name='form_delete_repo_other-repo']/input[@value='Delete']");
-		$this->assertTextPresent("Repository other-repo is marked for deletion");
-
 		// Run the cronjob to create repositories
 		$this->cron("create_scm_repos.php");
 
-		$this->open(ROOT.'/plugins/scmgit/cgi-bin/gitweb.cgi?a=project_list;pf=projecta');
-		$this->waitForPageToLoad();
-		$this->assertElementPresent("//.[@class='page_footer']");
-		$this->assertTextPresent("projecta.git");
-		$this->assertTextNotPresent("other-repo.git");
-		$this->assertTextPresent("users/".FORGE_ADMIN_USERNAME.".git");
-
 		// Get the address of the repo
 		$this->open(ROOT);
 		$this->clickAndWait("link=ProjectA");
 		$this->clickAndWait("link=SCM");
-		$p = $this->getText("//tt[contains(.,'git clone git+ssh')]");
+		$p = $this->getText("//tt[contains(.,'git clone http')]");
 		$p = preg_replace(",^git clone ,", "", $p);
 		$p = preg_replace(",://.*@,", "://root@", $p);
 
diff --git a/tests/func/PluginsScmGit/gitTest.php b/tests/func/PluginsScmGit/gitWUITest.php
similarity index 70%
rename from tests/func/PluginsScmGit/gitTest.php
rename to tests/func/PluginsScmGit/gitWUITest.php
index 5656f6d..704ef36 100644
--- a/tests/func/PluginsScmGit/gitTest.php
+++ b/tests/func/PluginsScmGit/gitWUITest.php
@@ -21,9 +21,9 @@
 
 require_once dirname(dirname(__FILE__)).'/Testing/SeleniumGforge.php';
 
-class ScmGitTest extends FForge_SeleniumTestCase
+class ScmGitWUITest extends FForge_SeleniumTestCase
 {
-	function testScmGit()
+	function testScmGitWUI()
 	{
 		$this->activatePlugin('scmgit');
 		$this->populateStandardTemplate('empty');
@@ -81,40 +81,6 @@ class ScmGitTest extends FForge_SeleniumTestCase
 		$this->assertTextPresent("projecta.git");
 		$this->assertTextNotPresent("other-repo.git");
 		$this->assertTextPresent("users/".FORGE_ADMIN_USERNAME.".git");
-
-		// Get the address of the repo
-		$this->open(ROOT);
-		$this->clickAndWait("link=ProjectA");
-		$this->clickAndWait("link=SCM");
-		$p = $this->getText("//tt[contains(.,'git clone git+ssh')]");
-		$p = preg_replace(",^git clone ,", "", $p);
-		$p = preg_replace(",://.*@,", "://root@", $p);
-
-		// Create a local clone, add stuff, push it to the repo
-		$t = exec("mktemp -d /tmp/gitTest.XXXXXX");
-		system("cd $t && git clone --quiet $p", $ret);
-		$this->assertEquals($ret, 0);
-
-		system("echo 'this is a simple text' > $t/projecta/mytext.txt");
-		system("cd $t/projecta && git add mytext.txt && git commit --quiet -a -m'Adding file'", $ret);
-		system("echo 'another simple text' >> $t/projecta/mytext.txt");
-		system("cd $t/projecta && git commit --quiet -a -m'Modifying file'", $ret);
-		$this->assertEquals($ret, 0);
-
-		system("cd $t/projecta && git push --quiet --all", $ret);
-		$this->assertEquals($ret, 0);
-
-		// Check that the changes appear in gitweb
-		$this->open(ROOT.'/plugins/scmgit/cgi-bin/gitweb.cgi?a=project_list;pf=projecta');
-		$this->waitForPageToLoad();
-		$this->assertElementPresent("//.[@class='page_footer']");
-		$this->assertTextPresent("projecta.git");
-		$this->click("link=projecta/projecta.git");
-		$this->waitForPageToLoad();
-		$this->assertTextPresent("Modifying file");
-		$this->assertTextPresent("Adding file");
-
-		system("rm -fr $t");
 	}
 
 	/**

commit 31ceaf4760b22b868cba29da5ea3c7346d952199
Author: Roland Mas <roland at gnurandal.com>
Date:   Fri Apr 18 06:43:52 2014 +0200

    Added machinery for Git read/write access over the HTTP smart protocol

diff --git a/src/etc/httpd.conf.d/05-config-macros-scmgit.conf b/src/etc/httpd.conf.d/05-config-macros-scmgit.conf
new file mode 100644
index 0000000..8d1c0ea
--- /dev/null
+++ b/src/etc/httpd.conf.d/05-config-macros-scmgit.conf
@@ -0,0 +1,31 @@
+<Macro ScmgitProjectWithAnon $project>
+<LocationMatch "^/git/$project/">
+  Require all granted
+</LocationMatch>
+
+<LocationMatch "^/authgit/[^/]+/$project/">
+  Require valid-user
+</LocationMatch>
+</Macro>
+
+<Macro ScmgitProjectWithoutAnon $project>
+<LocationMatch "^/authgit/[^/]+/$project/">
+  Require group scm_$project
+</LocationMatch>
+
+<LocationMatch "^/authgit/[^/]+/$project/.*/git-receive-pack$">
+  AuthMerging And
+  Require group scm_$project
+</LocationMatch>
+</Macro>
+
+<Macro ScmgitUser $user>
+<LocationMatch "^/authgit/$user/">
+  Require user $user
+</LocationMatch>
+
+<LocationMatch "^/authgit/[^/]/[^/]users/$user/git-receive-pack$">
+  AuthMerging And
+  Require user $user
+</LocationMatch>
+</Macro>
diff --git a/src/etc/httpd.conf.d/50-vhosts-scm.conf b/src/etc/httpd.conf.d/20-vhosts-scm.conf
similarity index 100%
rename from src/etc/httpd.conf.d/50-vhosts-scm.conf
rename to src/etc/httpd.conf.d/20-vhosts-scm.conf
diff --git a/src/etc/httpd.conf.d/plugin-scmgit.inc b/src/etc/httpd.conf.d/plugin-scmgit.inc
index cde6424..7b406fd 100644
--- a/src/etc/httpd.conf.d/plugin-scmgit.inc
+++ b/src/etc/httpd.conf.d/plugin-scmgit.inc
@@ -1,3 +1,16 @@
 <Directory {core/source_path}/plugins/scmgit/cgi-bin>
   SetEnv GITWEB_CONFIG {core/config_path}/plugins/scmgit/gitweb.conf
 </Directory>
+
+SetEnv GIT_PROJECT_ROOT {scmgit/repos_path}
+SetEnv GIT_HTTP_EXPORT_ALL
+
+ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
+ScriptAliasMatch ^/authgit/[^/]+/(.*) /usr/lib/git-core/git-http-backend/$1
+
+<LocationMatch "^/authgit/">
+  AuthType Basic
+  AuthName "SCM for {core/forge_name}"
+  AuthUserFile {core/data_path}/scmgit-userfile
+  AuthGroupFile {core/data_path}/scmgit-groupfile
+</LocationMatch>
diff --git a/src/etc/httpd.conf.d/vhost-scm-plugin-scmgit.inc b/src/etc/httpd.conf.d/vhost-scm-plugin-scmgit.inc
new file mode 100644
index 0000000..0b81fc4
--- /dev/null
+++ b/src/etc/httpd.conf.d/vhost-scm-plugin-scmgit.inc
@@ -0,0 +1,2 @@
+SetEnvIf Request_URI ^/authgit/([^/]+)/ ITKUID=$1
+SetEnvIf Request_URI ^/authgit/([^/]+)/([^/]+)/ ITKGID=$2
diff --git a/src/etc/httpd.conf.d/vhost-scm.inc b/src/etc/httpd.conf.d/vhost-scm.inc
index 0d2064e..7d88c20 100644
--- a/src/etc/httpd.conf.d/vhost-scm.inc
+++ b/src/etc/httpd.conf.d/vhost-scm.inc
@@ -1,8 +1,18 @@
 ServerName {core/scm_host}
 
+SetEnvIf Request_URI . ITKUID=www-data
+SetEnvIf Request_URI . ITKGID=www-data
+
 <IfVersion >= 2.3>
   IncludeOptional {core/config_path}/httpd.conf.d/plugin-scm*.inc
+  IncludeOptional {core/config_path}/httpd.conf.d/vhost-scm-plugin-scm*.inc
+  IncludeOptional {core/data_path}/scmgit-auth*.inc
 </IfVersion>
 <IfVersion < 2.3>
   Include {core/config_path}/httpd.conf.d/plugin-scm*.inc
+  Include {core/config_path}/httpd.conf.d/vhost-scm-plugin-scm*.inc
+  Include {core/data_path}/scmgit-auth*.inc
 </IfVersion>
+
+AssignUserIDExpr %{reqenv:ITKUID}
+AssignGroupIDExpr %{reqenv:ITKGID}
diff --git a/src/install/deps b/src/install/deps
index 4d155fa..cf76489 100644
--- a/src/install/deps
+++ b/src/install/deps
@@ -81,6 +81,7 @@ deps_debian() {
 	apt-get -y --force-yes install python-moinmoin python-psycopg2 python-pygments libapache2-mod-wsgi
 	apt-get -y --force-yes install mediawiki
 	apt-get -y --force-yes install git gitweb
+	apt-get -y --force-yes install libapache2-mpm-itk
 	a2enmod headers
 	a2enmod proxy
 	a2enmod ssl
diff --git a/src/install/install5_post b/src/install/install5_post
index d8ea1b4..9a62e39 100644
--- a/src/install/install5_post
+++ b/src/install/install5_post
@@ -31,7 +31,7 @@ install5_post_suse()
 	chkconfig -s postgresql on
 
 	# Apache settings: modules
-	for m in dav dav_svn authz_svn ssl; do
+	for m in dav dav_svn authz_svn ssl macro authz_groupfile; do
 		a2enmod $m
 		a2enflag $m
 	done
@@ -73,7 +73,7 @@ install5_post_debian()
         done
 
 	# Apache settings: modules
-	for m in dav dav_svn authz_svn ssl; do
+	for m in dav dav_svn authz_svn ssl macro authz_groupfile; do
 		a2enmod $m
 	done
 
diff --git a/src/packaging/control/030web-apache2 b/src/packaging/control/030web-apache2
index 9ca1856..0ec7831 100644
--- a/src/packaging/control/030web-apache2
+++ b/src/packaging/control/030web-apache2
@@ -1,6 +1,6 @@
 Package: @OLDPACKAGE at -web-apache2
 Architecture: all
-Depends: @OLDPACKAGE at -common, @OLDPACKAGE at -db-postgresql | @OLDPACKAGE at -db, libapache2-mod-php5, php5-cgi, php5-pgsql, php5-gd, perl, libdbi-perl, libdbd-pg-perl, debianutils (>= 1.7), debconf (>= 1.0.32) | debconf-2.0, ucf, python, ssl-cert, libnusoap-php, libphp-simplepie, php-http, php-http-webdav-server, libjs-jquery, libjs-jquery-tipsy, libjs-jquery-ui, libjs-jquery-ui-theme-overcast, javascript-common, ${misc:Depends}
+Depends: @OLDPACKAGE at -common, @OLDPACKAGE at -db-postgresql | @OLDPACKAGE at -db, libapache2-mpm-itk | apache2-mpm-itk, libapache2-mod-php5, php5-cgi, php5-pgsql, php5-gd, perl, libdbi-perl, libdbd-pg-perl, debianutils (>= 1.7), debconf (>= 1.0.32) | debconf-2.0, ucf, python, ssl-cert, libnusoap-php, libphp-simplepie, php-http, php-http-webdav-server, libjs-jquery, libjs-jquery-tipsy, libjs-jquery-ui, libjs-jquery-ui-theme-overcast, javascript-common, ${misc:Depends}
 Recommends: locales | locales-all
 Provides: @OLDPACKAGE at -web
 Conflicts: @OLDPACKAGE at -web
diff --git a/src/plugins/scmgit/common/GitPlugin.class.php b/src/plugins/scmgit/common/GitPlugin.class.php
index 93bee6a..7000fcb 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -97,6 +97,14 @@ class GitPlugin extends SCMPlugin {
 		for ($i=0; $i<$rows; $i++) {
 			$repo_list[] = db_result($result,$i,'repo_name');
 		}
+		$clone_commands = array();
+		foreach ($repo_list as $repo_name) {
+			$clone_commands[] = 'git clone '.util_make_url('/anonscm/git/'.$project->getUnixName().'/'.$repo_name.'.git');
+			if (forge_get_config('use_smarthttp', 'scmgit')) {
+				$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
+				$clone_commands[] = 'git clone '.$protocol.'://'.forge_get_config('scm_host').'/git/'.$project->getUnixName().'/'.$repo_name.'.git';
+			}
+		}
 
 		$b = '<h2>' . ngettext('Anonymous Access to the Git repository',
 				       'Anonymous Access to the Git repositories',
@@ -109,9 +117,9 @@ class GitPlugin extends SCMPlugin {
 
 		$b .= '</p>';
 
-		foreach ($repo_list as $repo_name) {
+		foreach ($clone_commands as $cmd) {
 			$b .= '<p>';
-			$b .= '<tt>git clone '.util_make_url('/anonscm/git/'.$project->getUnixName().'/'.$repo_name.'.git').'</tt><br />';
+			$b .= '<tt>'.$cmd.'</tt><br />';
 			$b .= '</p>';
 		}
 
@@ -157,12 +165,13 @@ class GitPlugin extends SCMPlugin {
 			$repo_list[] = db_result($result,$i,'repo_name');
 		}
 
+		$b = '';
 		if (session_loggedin()) {
 			$u = user_get_object(user_getid());
 			$d = $u->getUnixName();
 			if (forge_get_config('use_ssh', 'scmgit')) {
-				$b = '<h2>';
-				$b = ngettext('Developer Access to the Git repository via SSH',
+				$b .= '<h2>';
+				$b .= ngettext('Developer Access to the Git repository via SSH',
 						       'Developer Access to the Git repositories via SSH',
 						       count($repo_list));
 				$b .= '</h2>';
@@ -178,10 +187,29 @@ class GitPlugin extends SCMPlugin {
 				foreach ($repo_list as $repo_name) {
 					$b .= '<p><tt>git clone git+ssh://'.$d.'@' . $project->getSCMBox() . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $repo_name .'.git</tt></p>';
 				}
-			} elseif (forge_get_config('use_dav', 'scmgit')) {
+			}
+			if (forge_get_config('use_smarthttp', 'scmgit')) {
+				$b .= '<h2>';
+				$b .= ngettext('Developer Access to the Git repository via “smart HTTP”',
+					      'Developer Access to the Git repositories via “smart HTTP”',
+					      count($repo_list));
+				$b .= '</h2>';
+				$b .= '<p>';
+				$b .= ngettext('Only project developers can access the Git repository via this method.',
+					       'Only project developers can access the Git repositories via this method.',
+					       count($repo_list));
+				$b .= ' ';
+				$b .= _('Enter your site password when prompted.');
+				$b .= '</p>';
+				$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
+				foreach ($repo_list as $repo_name) {
+					$b .= '<p><tt>git clone '.$protocol.'://'.$d.'@' . forge_get_config('scm_host').'/authgit/'.$d.'/'.$project->getUnixName() .'/'. $repo_name .'.git</tt></p>';
+				}
+			}
+			if (forge_get_config('use_dav', 'scmgit')) {
 				$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
-				$b = '<h2>';
-				$b = ngettext('Developer Access to the Git repository via HTTP',
+				$b .= '<h2>';
+				$b .= ngettext('Developer Access to the Git repository via HTTP',
 						       'Developer Access to the Git repositories via HTTP',
 						       count($repo_list));
 				$b .= '</h2>';
@@ -217,9 +245,28 @@ class GitPlugin extends SCMPlugin {
 				foreach ($repo_list as $repo_name) {
 					$b .= '<p><tt>git clone git+ssh://<i>'._('developername').'</i>@' . $project->getSCMBox() . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $repo_name .'.git</tt></p>';
 				}
-			} elseif (forge_get_config('use_dav', 'scmgit')) {
-				$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
+			}
+			if (forge_get_config('use_smarthttp', 'scmgit')) {
 				$b = '<h2>';
+				$b = ngettext('Developer Access to the Git repository via “smart HTTP”',
+					      'Developer Access to the Git repositories via “smart HTTP”',
+					      count($repo_list));
+				$b .= '</h2>';
+				$b .= '<p>';
+				$b .= ngettext('Only project developers can access the Git repository via this method.',
+					       'Only project developers can access the Git repositories via this method.',
+					       count($repo_list));
+				$b .= ' ';
+				$b .= _('Enter your site password when prompted.');
+				$b .= '</p>';
+				$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
+				foreach ($repo_list as $repo_name) {
+					$b .= '<p><tt>git clone '.$protocol.'://<i>'._('developername').'</i>@' . forge_get_config('scm_host').'/authgit/<i>'._('developername').'</i>/'.$project->getUnixName() .'/'. $repo_name .'.git</tt></p>';
+				}
+			}
+			if (forge_get_config('use_dav', 'scmgit')) {
+				$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
+				$b .= '<h2>';
 				$b .= ngettext('Developer Access to the Git repository via HTTP',
 						       'Developer Access to the Git repositories via HTTP',
 						       count($repo_list));
@@ -237,8 +284,8 @@ class GitPlugin extends SCMPlugin {
 			}
 		}
 
-		if (!isset($b)) {
-			$b = '<h2>'._('Developer Git Access').'</h2>';
+		if ($b == '') {
+			$b .= '<h2>'._('Developer Git Access').'</h2>';
 			$b .= '<p class="error">Error: No access protocol has been allowed for the Git plugin in scmgit.ini: : use_ssh and use_dav are disabled</p>';
 		}
 
@@ -401,6 +448,7 @@ class GitPlugin extends SCMPlugin {
 			// 'cd $root' because git will abort if e.g. we're in a 0700 /root after setuid
 			system("cd $root;git clone --bare --quiet --no-hardlinks $main_repo $repodir");
 			system("GIT_DIR=\"$repodir\" git update-server-info");
+			system("GIT_DIR=\"$repodir\" git config http.receivepack true");
 			if (is_file("$repodir/hooks/post-update.sample")) {
 				rename("$repodir/hooks/post-update.sample",
 					"$repodir/hooks/post-update");
@@ -454,6 +502,7 @@ class GitPlugin extends SCMPlugin {
 			$output .= join("<br />", $result);
 			$result = '';
 			exec("GIT_DIR=\"$tmp_repo\" git update-server-info", $result);
+			exec("GIT_DIR=\"$tmp_repo\" git config http.receivepack true", $result);
 			$output .= join("<br />", $result);
 			if (is_file("$tmp_repo/hooks/post-update.sample")) {
 				rename("$tmp_repo/hooks/post-update.sample",
@@ -531,6 +580,7 @@ class GitPlugin extends SCMPlugin {
 					system("GIT_DIR=\"$repodir\" git init --quiet --bare --shared=group");
 				}
 				system("GIT_DIR=\"$repodir\" git update-server-info");
+				system("GIT_DIR=\"$repodir\" git config http.receivepack true");
 				if (is_file("$repodir/hooks/post-update.sample")) {
 					rename("$repodir/hooks/post-update.sample",
 						"$repodir/hooks/post-update");
@@ -628,26 +678,25 @@ class GitPlugin extends SCMPlugin {
 			mkdir($config_dir, 0755, true);
 		}
 		$fname = $config_dir . '/gitweb.conf';
-		$config_f = fopen($fname.'.new', 'w');
+		$f = fopen($fname.'.new', 'w');
 		$rootdir = forge_get_config('repos_path', 'scmgit');
-		fwrite($config_f, "\$projectroot = '$rootdir';\n");
-		fwrite($config_f, "\$projects_list = '$config_dir/gitweb.list';\n");
-		fwrite($config_f, "@git_base_url_list = ('". util_make_url('/anonscm/git') . "');\n");
-		fwrite($config_f, "\$logo = '". util_make_url('/plugins/scmgit/git-logo.png') . "';\n");
-		fwrite($config_f, "\$favicon = '". util_make_url('/plugins/scmgit/git-favicon.png')."';\n");
-		fwrite($config_f, "\$stylesheet = '". util_make_url('/plugins/scmgit/gitweb.css')."';\n");
-		fwrite($config_f, "\$javascript = '". util_make_url('/plugins/scmgit/gitweb.js')."';\n");
-		fwrite($config_f, "\$prevent_xss = 'true';\n");
-		fwrite($config_f, "\$feature{'actions'}{'default'} = [('project home', '" .
-		    util_make_url('/plugins/scmgit/?func=grouppage/%n') .
-		    "', 'summary')];\n");
-		fclose($config_f);
+		fwrite($f, "\$projectroot = '$rootdir';\n");
+		fwrite($f, "\$projects_list = '$config_dir/gitweb.list';\n");
+		fwrite($f, "@git_base_url_list = ('". util_make_url('/anonscm/git') . "');\n");
+		fwrite($f, "\$logo = '". util_make_url('/plugins/scmgit/git-logo.png') . "';\n");
+		fwrite($f, "\$favicon = '". util_make_url('/plugins/scmgit/git-favicon.png')."';\n");
+		fwrite($f, "\$stylesheet = '". util_make_url('/plugins/scmgit/gitweb.css')."';\n");
+		fwrite($f, "\$javascript = '". util_make_url('/plugins/scmgit/gitweb.js')."';\n");
+		fwrite($f, "\$prevent_xss = 'true';\n");
+		fwrite($f, "\$feature{'actions'}{'default'} = [('project home', '" .
+		       util_make_url('/plugins/scmgit/?func=grouppage/%n') .
+		       "', 'summary')];\n");
+		fclose($f);
 		chmod($fname.'.new', 0644);
 		rename($fname.'.new', $fname);
 
 		$fname = $config_dir . '/gitweb.list';
 		$f = fopen($fname.'.new', 'w');
-
 		$engine = RBACEngine::getInstance();
 		foreach ($list as $project) {
 			$repos = $this->getRepositories($rootdir . "/" .  $project->getUnixName());
@@ -671,6 +720,74 @@ class GitPlugin extends SCMPlugin {
 		fclose($f);
 		chmod($fname.'.new', 0644);
 		rename($fname.'.new', $fname);
+
+		if (forge_get_config('use_smarthttp', 'scmgit')) {
+			$gitusers = array();
+			
+			$config_fname = forge_get_config('data_path').'/scmgit-auth.inc';
+			$config_f = fopen($config_fname.'.new', 'w');
+			
+			$user_fname = forge_get_config('data_path').'/scmgit-userfile';
+			$user_f = fopen($user_fname.'.new', 'w');
+			
+			$group_fname = forge_get_config('data_path').'/scmgit-groupfile';
+			$group_f = fopen($group_fname.'.new', 'w');
+			
+			fwrite($config_f, '');
+			
+			foreach ($groups as $project) {
+				if ( !$project->isActive()) {
+					continue;
+				}
+				if ( !$project->usesSCM()) {
+					continue;
+				}
+				$rusers = $engine->getUsersByAllowedAction('scm',$project->getID(),'read');
+				fwrite($group_f, $project->getUnixName().':');
+				foreach ($rusers as $user) {
+					$gitusers[$user->getID()] = $user;
+					fwrite($group_f, ' '.$user->getUnixName());
+				}
+				fwrite($group_f, "\n");
+				
+				$wusers = $engine->getUsersByAllowedAction('scm',$project->getID(),'write');
+				fwrite($group_f, 'scm_'.$project->getUnixName().':');
+				foreach ($wusers as $user) {
+					fwrite($group_f, ' '.$user->getUnixName());
+				}
+				fwrite($group_f, "\n");
+				
+				
+				if ($project->enableAnonSCM()) {
+					fwrite($config_f, 'Use ScmgitProjectWithAnon '.$project->getUnixName().'
+');
+				} else {
+					fwrite($config_f, 'Use ScmgitProjectWithoutAnon '.$project->getUnixName().'
+');
+				}
+				
+				fwrite($config_f, "\n");
+			}
+			$password_data = '';
+			foreach ($gitusers as $user) {
+				$password_data .= $user->getUnixName().':'.$user->getUnixPasswd()."\n";
+				fwrite($config_f, 'Use ScmgitUser '.$user->getUnixName().'
+');
+			}
+			fwrite($user_f, $password_data);
+			
+			fclose($config_f);
+			chmod($config_fname.'.new', 0644);
+			rename($config_fname.'.new', $config_fname);
+			
+			fclose($group_f);
+			chmod($group_fname.'.new', 0644);
+			rename($group_fname.'.new', $group_fname);
+			
+			fclose($user_f);
+			chmod($user_fname.'.new', 0644);
+			rename($user_fname.'.new', $user_fname);
+		}
 	}
 
 	function getRepositories($path) {
diff --git a/src/plugins/scmgit/etc/scmgit.ini b/src/plugins/scmgit/etc/scmgit.ini
index 13db5cd..b27291f 100644
--- a/src/plugins/scmgit/etc/scmgit.ini
+++ b/src/plugins/scmgit/etc/scmgit.ini
@@ -22,4 +22,5 @@ httpd_reload_cmd = "service httpd reload"
 ; use_dav or use_ssh is exclusive. you cannot enable dav with ssh, or ssh with dav
 use_dav = yes
 use_ssh = no
+use_smarthttp = yes
 use_ssl = "$core/use_ssl"
diff --git a/src/plugins/scmgit/packaging/control/133plugin-scmgit b/src/plugins/scmgit/packaging/control/133plugin-scmgit
index cf8a3c5..654f091 100644
--- a/src/plugins/scmgit/packaging/control/133plugin-scmgit
+++ b/src/plugins/scmgit/packaging/control/133plugin-scmgit
@@ -1,6 +1,6 @@
 Package: @PACKAGE at -plugin-scmgit
 Architecture: all
-Depends: @OLDPACKAGE at -common, @OLDPACKAGE at -db-postgresql | @OLDPACKAGE at -db, @OLDPACKAGE at -web-apache2 | @OLDPACKAGE at -web, @OLDPACKAGE at -shell-postgresql | @OLDPACKAGE at -shell, git (>= 1:1.7) | git-core, gitweb (>= 1:1.7.4.1), php5-cli, ${misc:Depends}
+Depends: @OLDPACKAGE at -common, @OLDPACKAGE at -db-postgresql | @OLDPACKAGE at -db, @OLDPACKAGE at -web-apache2 | @OLDPACKAGE at -web, @OLDPACKAGE at -shell-postgresql | @OLDPACKAGE at -shell, git (>= 1:1.7) | git-core, gitweb (>= 1:1.7.4.1), php5-cli, acl, ${misc:Depends}
 Provides: @PACKAGE at -plugin-scm, @OLDPACKAGE at -plugin-scmgit
 Conflicts: @OLDPACKAGE at -plugin-scmgit (<< 5.0.51-2)
 Replaces: @OLDPACKAGE at -plugin-scmgit (<< 5.0.51-2)
diff --git a/src/plugins/scmsvn/packaging/control/131plugin-scmsvn b/src/plugins/scmsvn/packaging/control/131plugin-scmsvn
index 1f56f1e..18fa19b 100644
--- a/src/plugins/scmsvn/packaging/control/131plugin-scmsvn
+++ b/src/plugins/scmsvn/packaging/control/131plugin-scmsvn
@@ -1,6 +1,6 @@
 Package: @PACKAGE at -plugin-scmsvn
 Architecture: all
-Depends: @OLDPACKAGE at -common, @OLDPACKAGE at -db-postgresql | @OLDPACKAGE at -db, @OLDPACKAGE at -shell-postgresql | @OLDPACKAGE at -shell, subversion, subversion-tools, python-subversion, python (>= 2.3), php5-cli, openbsd-inetd | inet-superserver, update-inetd, ${misc:Depends}
+Depends: @OLDPACKAGE at -common, @OLDPACKAGE at -db-postgresql | @OLDPACKAGE at -db, @OLDPACKAGE at -shell-postgresql | @OLDPACKAGE at -shell, subversion, subversion-tools, python-subversion, python (>= 2.3), php5-cli, openbsd-inetd | inet-superserver, update-inetd, acl, ${misc:Depends}
 Recommends: libapache2-svn, @OLDPACKAGE at -web-apache2 | @OLDPACKAGE at -web
 Provides: @PACKAGE at -plugin-scm, @OLDPACKAGE at -plugin-scmsvn
 Conflicts: @OLDPACKAGE at -plugin-scmsvn

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list