Commit fc42b62ecabfb2449a8e6deaa4ff399e8ddc7a2b
- Date: Sun Feb 03 23:03:55 +0000 2008
- Committer: Johan Sørensen (johan@johansorensen.com)
- Author: Johan Sørensen (johan@johansorensen.com)
- Commit SHA1: fc42b62ecabfb2449a8e6deaa4ff399e8ddc7a2b
- Tree SHA1: d907ab1f75438cb9b47c7cde425a3a503c5e8b6e
Added a failsafe for checking that the repos deletion path is sane
Commit diff
| |   |
| 23 | 23 | [ ] Detect renames etc when showing a commit |
| 24 | 24 | [ ] Always add a "mainline-upstream" branch that track the mainline repos automagically to clones |
| 25 | 25 | [ ] email repository owners when there's a new comment |
| 26 | | [ ] Clean up in Diff::Display::Unified |
| 26 | [*] Clean up in Diff::Display::Unified |
| 27 | 27 | --- |
| 28 | 28 | |
| 29 | 29 | a 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 |
--- a/TODO.txt
+++ b/TODO.txt
@@ -23,7 +23,7 @@
[ ] Detect renames etc when showing a commit
[ ] Always add a "mainline-upstream" branch that track the mainline repos automagically to clones
[ ] email repository owners when there's a new comment
-[ ] Clean up in Diff::Display::Unified
+[*] Clean up in Diff::Display::Unified
---
a 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. |
| |   |
| 2 | 2 | acts_as_taggable |
| 3 | 3 | |
| 4 | 4 | belongs_to :user |
| 5 | | has_many :comments |
| 5 | has_many :comments, :dependent => :destroy |
| 6 | 6 | has_many :repositories, :order => "mainline desc, created_at asc", |
| 7 | 7 | :dependent => :destroy |
| 8 | 8 | has_one :mainline_repository, :conditions => ["mainline = ?", true], |
| toggle raw diff |
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2,7 +2,7 @@ class Project < ActiveRecord::Base
acts_as_taggable
belongs_to :user
- has_many :comments
+ has_many :comments, :dependent => :destroy
has_many :repositories, :order => "mainline desc, created_at asc",
:dependent => :destroy
has_one :mainline_repository, :conditions => ["mainline = ?", true], |
| |   |
| 97 | 97 | |
| 98 | 98 | def create_delete_repos_task |
| 99 | 99 | 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]) |
| 101 | 101 | end |
| 102 | 102 | |
| 103 | 103 | protected |
| toggle raw diff |
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -97,7 +97,7 @@ class Repository < ActiveRecord::Base
def create_delete_repos_task
Task.create!(:target_class => self.class.name,
- :command => "delete_git_repository", :arguments => [gitdir]) # fixme: gitdir is probably gone in after_destroy
+ :command => "delete_git_repository", :arguments => [gitdir])
end
protected |
| |   |
| 20 | 20 | end |
| 21 | 21 | |
| 22 | 22 | 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 |
| 24 | 28 | end |
| 25 | 29 | |
| 26 | 30 | def repository_has_commits?(repos_path) |
| toggle raw diff |
--- a/lib/git_backend.rb
+++ b/lib/git_backend.rb
@@ -20,7 +20,11 @@ class GitBackend
end
def delete!(repos_path)
- FileUtils.rm_rf(repos_path)
+ if repos_path.index(GitoriousConfig["repository_base_path"]) == 0
+ FileUtils.rm_rf(repos_path)
+ else
+ raise "bad path"
+ end
end
def repository_has_commits?(repos_path) |