Changeset - bcb807305731
[Not reviewed]
default
0 1 0
Andrew Shadura - 9 years ago 2016-07-14 14:47:38
andrew@shadura.me
db: ensure git hooks work when the repositories base path is a symlink

When a Git hook starts, it thinks its repo_path is its cwd.
However, if the repositories base path is a symlink to a different
location, base path won't match the location of the repository
where the symlink will be resolved.
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/model/db.py
Show inline comments
 
@@ -1096,7 +1096,10 @@ class Repository(Base, BaseModel):
 

	
 
    @classmethod
 
    def get_by_full_path(cls, repo_full_path):
 
        repo_name = repo_full_path.split(cls.base_path(), 1)[-1]
 
        base_full_path = os.path.realpath(cls.base_path())
 
        repo_full_path = os.path.realpath(repo_full_path)
 
        assert repo_full_path.startswith(base_full_path + os.path.sep)
 
        repo_name = repo_full_path[len(base_full_path) + 1:]
 
        repo_name = cls.normalize_repo_name(repo_name)
 
        return cls.get_by_repo_name(repo_name.strip(URL_SEP))
 

	
0 comments (0 inline, 0 general)