kubitron / redmine_git_hosting

A ChiliProject/Redmine plugin which makes configuring your own git hosting easy.
78 stars 15 forks source link

Unintended moving of repositories #96

Closed michaelernst closed 11 years ago

michaelernst commented 11 years ago

Hi,

I decided to name all the main repositories of the projects 'repository' - therefore I set the unique repository identifier setting to false. While I was recreating my projects I noticed a strange behavior. Sometimes the plugin just moved a repository to another project instead of creating a new one.

I am using Redmine 1.4.5 - to recreate this behavior: set the unique repo identifier to false, create a project, put two subprojects beneath it and create repositories with the same name.

Log file: Processing ProjectsController#settings Parameters: {"action"=>"settings", "id"=>"test", "controller"=>"projects"} Fetching changes from gitolite-admin repository to /tmp/redmine_git_hosting/git/gitolite-admin Our hook is already installed Creating new entry 'test/repository' in gitolite.conf Letting gitolite create empty repository: 'repositories/test/repository.git' Committing changes to gitolite-admin repository Setting up hooks for repository 'test/repository' (in gitolite repository at 'repositories/test/repository.git') Rendering template within layouts/base Rendering projects/settings

Processing RepositoriesController#create Parameters: {"repository"=>{"is_default"=>"1", "identifier"=>"repository"}, "commit"=>"Create", "project_id"=>"test_sub1", "action"=>"create", "authenticity_token"=>"oyN3xVkLvx3FR1p1Gs+MjRW2nkFJUPVeYD3AKh+EfWY=", "controller"=>"repositories", "extra"=>{"git_http"=>"1", "git_daemon"=>"1", "notify_cia"=>"0"}, "repository_scm"=>"Git"} Fetching changes from gitolite-admin repository to /tmp/redmine_git_hosting/git/gitolite-admin Our hook is already installed Moving entry 'test/repository' to 'test/test_sub1/repository' in gitolite.conf. Moving gitolite repository from 'test/repository.git' to 'test/test_sub1/repository.git' Committing changes to gitolite-admin repository Repairing hooks for repository 'test/test_sub1/repository' (in gitolite repository at 'repositories/test/test_sub1/repository.git')

kubitron commented 11 years ago

Can you tell me a bit more about the sequence of events here? Did this move happen during the creation of the new repository for project "test/test_sub1", but after you already created a repository for "test"?

Did you expect the creation of a new "test/test_sub1/repository" repo rather than a move of the existing one?

kubitron commented 11 years ago

OOps -- nix that question. Looks like you answered it already (sorry).

michaelernst commented 11 years ago

Hu, thanks for the fast reply :).

If you need any additional information, just let me know

kubitron commented 11 years ago

Ok. Won't be able to get to this for a day or so.

michaelernst commented 11 years ago

I set up a vps system which demonstrates the issue. I wrote you a mail with the login information - I hope this is ok, I did not want to post this publicly

kubitron commented 11 years ago

Thanks. Sorry for not responding -- I'm busy grading at end of term.

I have a reasonably good idea what happened. I just have to find time to fix it.

I'll look at this as soon as I can.

kubitron commented 11 years ago

Hello. Sorry for the delay.

Can you try pulling from the master branch again and see if this fixes your problem? It turns out that your use case (zillions of repos with the same identifier) wasn't something that I had really considered. :-). There was a subtle bug that caused me to rewrite the path handling code to improve both correctness and performance in that circumstance.

michaelernst commented 11 years ago

Hi,

I just checked it, it seems to work. Thanks for the fix :).

kubitron commented 11 years ago

Great! Since you are an "extreme" user (with respect to this issue :-), please watch carefully for unexpected behavior. I changed the overall algorithm, so may have introduced a bug in the process.

Thanks for the feedback.