Changeset - 320806ff6be2
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 14 years ago 2012-02-27 06:46:52
marcin@python-works.com
fixes git-protocol with
2 files changed with 10 insertions and 1 deletions:
0 comments (0 inline, 0 general)
docs/changelog.rst
Show inline comments
 
@@ -14,12 +14,13 @@ news
 
++++
 

	
 

	
 
fixes
 
+++++
 

	
 
- fixed git protocol issues with repos-groups
 

	
 
1.3.1 (**2012-02-27**)
 
----------------------
 

	
 
news
 
++++
rhodecode/lib/middleware/simplegit.py
Show inline comments
 
@@ -22,12 +22,13 @@
 
# 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, see <http://www.gnu.org/licenses/>.
 

	
 
import os
 
import re
 
import logging
 
import traceback
 

	
 
from dulwich import server as dulserver
 

	
 

	
 
@@ -76,12 +77,15 @@ from rhodecode.model.db import User
 

	
 
from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs')
 

	
 

	
 
def is_git(environ):
 
    """Returns True if request's target is git server.
 
    ``HTTP_USER_AGENT`` would then have git client version given.
 

	
 
    :param environ:
 
    """
 
@@ -216,18 +220,22 @@ class SimpleGit(BaseVCSController):
 

	
 
        :param environ: environ where PATH_INFO is stored
 
        """
 
        try:
 
            environ['PATH_INFO'] = self._get_by_id(environ['PATH_INFO'])
 
            repo_name = '/'.join(environ['PATH_INFO'].split('/')[1:])
 
            repo_name = GIT_PROTO_PAT.split(repo_name)
 
            if repo_name:
 
                repo_name = repo_name[0]
 

	
 
            if repo_name.endswith('/'):
 
                repo_name = repo_name.rstrip('/')
 
        except:
 
            log.error(traceback.format_exc())
 
            raise
 
        repo_name = repo_name.split('/')[0]
 

	
 
        return repo_name
 

	
 
    def __get_user(self, username):
 
        return User.get_by_username(username)
 

	
 
    def __get_action(self, environ):
0 comments (0 inline, 0 general)