On Tue, Sep 25, 2012 at 8:56 AM, Thomas Kjeldahl Nilsson <
tho...@gitorious.com> wrote:

> On 09/25/2012 12:48 AM, Russell Jackson wrote:
>
>> Is there any reason why we can't look up the base path from gitorious.yml
>> like so?
>>
>> require 'pathname'
>> require 'yaml'
>>
>> incpath = File.dirname(__FILE__)
>>
>> hooks_realpath = Pathname.new(incpath).realpath
>> yaml_path = File.join(hooks_realpath, "..", "..", "config",
>> "gitorious.yml")
>> gitorious_yaml = YAML.load_file(yaml_path)
>> base_path = gitorious_yaml[ENV["RAILS_ENV"**]]["repository_base_path"]
>>
>> gitdir = File.expand_path(File.join(**incpath, ".."))
>> hashed_dir = gitdir.sub(/^#{base_path}\//, "")
>>
>> puts hashed_dir
>>
>
I'm actually working on supporting several repository roots in Gitorious
these days; gitorious.org currently runs with a single, several terabyte
file system keeping all the repository and this makes running fsck take a
really long time.

What I'm planning to do is to introduce a new database table (+Rails model)
to define filesystems that should be used for storing repositories. By
default your server will run off the single root defined in gitorious.yml,
but by creating additional roots you will be able to keep different
projects on different file systems (since Git repositories use hard links
to save space, we really don't want to clone across different file systems,
and cloning is only done within a project).

Anyway, to make this work, we'll need to have the repository itself resolve
its complete path on disk by combining its project's root path (either
defined in a RepositoryRoot instance or gitorious.yml) with its own
hashed_path attribute. In master right now, this is done by
RepositoryRoot.default_base_path, but I'm working on a feature branch
(features/multiple_roots) where this will be an instance method on
Repository.

Cheers,
- Marius

-- 
To post to this group, send email to gitorious@googlegroups.com
To unsubscribe from this group, send email to
gitorious+unsubscr...@googlegroups.com

Reply via email to