Changeset - 17556a81ec6f
[Not reviewed]
beta
0 1 0
Stefan Engel - 13 years ago 2012-09-25 21:11:23
mail@engel-stefan.de
Grafted from: 5ebecc80baf6
Make detecting bare Git repositories more robust

Git remote repositories may end on '.git', e.g. myrepo.git. Just checking
for a repository path to end on '.git' causes 'Repository not found' errors
in such a case. To distinguish between bare and normal Git repositories,
check if there is a '/.git' part at the end of the repository path
(i.e. if GIT_DIR is pointing to '.' (bare) or '.git').
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/hooks.py
Show inline comments
 
@@ -319,26 +319,26 @@ def handle_git_receive(repo_path, revs, 
 
    from rhodecode.lib.utils import make_ui
 
    extras = json.loads(env['RHODECODE_EXTRAS'])
 

	
 
    path, ini_name = os.path.split(extras['config'])
 
    conf = appconfig('config:%s' % ini_name, relative_to=path)
 
    load_environment(conf.global_conf, conf.local_conf)
 

	
 
    engine = engine_from_config(conf, 'sqlalchemy.db1.')
 
    init_model(engine)
 

	
 
    baseui = make_ui('db')
 
    # fix if it's not a bare repo
 
    if repo_path.endswith('.git'):
 
        repo_path = repo_path[:-4]
 
    if repo_path.endswith(os.sep + '.git'):
 
        repo_path = repo_path[:-5]
 

	
 
    repo = Repository.get_by_full_path(repo_path)
 
    if not repo:
 
        raise OSError('Repository %s not found in database'
 
                      % (safe_str(repo_path)))
 

	
 
    _hooks = dict(baseui.configitems('hooks')) or {}
 

	
 
    for k, v in extras.items():
 
        baseui.setconfig('rhodecode_extras', k, v)
 
    repo = repo.scm_instance
 
    repo.ui = baseui
0 comments (0 inline, 0 general)