Commit fc42b62ecabfb2449a8e6deaa4ff399e8ddc7a2b

Added a failsafe for checking that the repos deletion path is sane

Commit diff

TODO.txt

 
2323[ ] Detect renames etc when showing a commit
2424[ ] Always add a "mainline-upstream" branch that track the mainline repos automagically to clones
2525[ ] email repository owners when there's a new comment
26[ ] Clean up in Diff::Display::Unified
26[*] Clean up in Diff::Display::Unified
2727---
2828
2929a ProjectMirror that sucks in svn repositories. They need to be differentiated form normal projects (don't display owner etc, since it's a mirror). Also, the mainline repository should probably be immutable so people can commit changes to the actual mirror.
toggle raw diff

app/models/project.rb

 
22 acts_as_taggable
33
44 belongs_to :user
5 has_many :comments
5 has_many :comments, :dependent => :destroy
66 has_many :repositories, :order => "mainline desc, created_at asc",
77 :dependent => :destroy
88 has_one :mainline_repository, :conditions => ["mainline = ?", true],
toggle raw diff

app/models/repository.rb

 
9797
9898 def create_delete_repos_task
9999 Task.create!(:target_class => self.class.name,
100 :command => "delete_git_repository", :arguments => [gitdir]) # fixme: gitdir is probably gone in after_destroy
100 :command => "delete_git_repository", :arguments => [gitdir])
101101 end
102102
103103 protected
toggle raw diff

lib/git_backend.rb

 
2020 end
2121
2222 def delete!(repos_path)
23 FileUtils.rm_rf(repos_path)
23 if repos_path.index(GitoriousConfig["repository_base_path"]) == 0
24 FileUtils.rm_rf(repos_path)
25 else
26 raise "bad path"
27 end
2428 end
2529
2630 def repository_has_commits?(repos_path)
toggle raw diff