Project

General

Profile

Modifying Redmine.pm for use with gitosis and grack

Added by Lee Fay about 13 years ago

Hello, I've installed redmine with the redmine_gitosis plugin, and it's working wonderfully. However, I'd also like to use git-smart-http so I can push to my repos when I'm on campus (no SSH access). The problem is that in gitosis the repos have .git appended to them. I've successfully configured grack and applied the git-smart-http patch for Redmine.pm, and it will serve the repos, however when I try to add redmine's authentication to them, I hit a road block. It's also worth mentioning that if I copy the repo from "repo.git" to "repo", it will serve the repo with authentication and no errors.

I'm pretty sure I've narrowed down the problem to this function:

sub get_project_identifier {
my $r = shift;
my $location = $r->location;
my ($identifier) = $r->uri =~ m{$location/*([^/]+)};
$identifier;
}

I tried the following fix:
my ($identifier) = $r->uri =~ m{$location/*([^/]+).git};

I get a successful authentication for the GET part of the request, however the POST always returns 401, asking for authentication.

I'm only using git repos, so breaking compatibility isn't an issue here. I also have no experience with Perl, so if the solution is obvious, please excuse this post.


Replies (3)

RE: Modifying Redmine.pm for use with gitosis and grack - Added by Felix Schäfer about 13 years ago

The . (dot) in a regulart expression matches everything, you must escape it. Try:

my ($identifier) = $r->uri =~ m{$location/*([^/]+)\.git};

RE: Modifying Redmine.pm for use with gitosis and grack - Added by Lee Fay about 13 years ago

I completely forgot about that, I can't believe I missed something so simple. Thank you so much for pointing this out for me. Well, hopefully someone trying to accomplish the same thing I just did will find this page.

Thanks again!

RE: Modifying Redmine.pm for use with gitosis and grack - Added by Lee Fay about 13 years ago

I decided to take this idea a bit further, and have posted a patch to issue #4905 that allows repos to end in ".git".

Hope this will help someone. :)

    (1-3/3)