summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-10-01 20:34:41 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-10-01 20:34:41 +0300
commit970d86b7c5d0be871d8ab8d7cbd51997fd62e28a (patch)
tree82b6df1cb31ad65ec0ac369e38d61cbf21af05d4 /app/controllers/projects
parent68d89548cd7d796c78e7b9d3f7b64702d39d0f5c (diff)
downloadgitlab-ce-970d86b7c5d0be871d8ab8d7cbd51997fd62e28a.tar.gz
Refactor blob finding
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/blame_controller.rb2
-rw-r--r--app/controllers/projects/blob_controller.rb2
-rw-r--r--app/controllers/projects/edit_tree_controller.rb4
-rw-r--r--app/controllers/projects/raw_controller.rb2
4 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/projects/blame_controller.rb b/app/controllers/projects/blame_controller.rb
index f22c6497cbf..a3c41301676 100644
--- a/app/controllers/projects/blame_controller.rb
+++ b/app/controllers/projects/blame_controller.rb
@@ -8,7 +8,7 @@ class Projects::BlameController < Projects::ApplicationController
before_filter :require_non_empty_project
def show
- @blob = Gitlab::Git::Blob.find(@repository, @commit.id, @path)
+ @blob = @repository.blob_at(@commit.id, @path)
@blame = Gitlab::Git::Blame.new(project.repository, @commit.id, @path)
end
end
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index 878f25c7c03..ba466251b29 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -8,7 +8,7 @@ class Projects::BlobController < Projects::ApplicationController
before_filter :require_non_empty_project
def show
- @blob = Gitlab::Git::Blob.find(@repository, @commit.id, @path)
+ @blob = @repository.blob_at(@commit.id, @path)
not_found! unless @blob
end
diff --git a/app/controllers/projects/edit_tree_controller.rb b/app/controllers/projects/edit_tree_controller.rb
index edea80a5ccc..5d05c585ecc 100644
--- a/app/controllers/projects/edit_tree_controller.rb
+++ b/app/controllers/projects/edit_tree_controller.rb
@@ -10,7 +10,7 @@ class Projects::EditTreeController < Projects::ApplicationController
before_filter :edit_requirements, only: [:show, :update]
def show
- @last_commit = Gitlab::Git::Commit.last_for_path(@project.repository, @ref, @path).sha
+ @last_commit = Gitlab::Git::Commit.last_for_path(@repository, @ref, @path).sha
end
def update
@@ -32,7 +32,7 @@ class Projects::EditTreeController < Projects::ApplicationController
private
def edit_requirements
- @blob = Gitlab::Git::Blob.find(@repository, @commit.id, @path)
+ @blob = @repository.blob_at(@commit.id, @path)
unless @blob
redirect_to project_blob_path(@project, @id), notice: "You can only edit text files"
diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb
index 8633b225b64..18ace028b0c 100644
--- a/app/controllers/projects/raw_controller.rb
+++ b/app/controllers/projects/raw_controller.rb
@@ -8,7 +8,7 @@ class Projects::RawController < Projects::ApplicationController
before_filter :require_non_empty_project
def show
- @blob = Gitlab::Git::Blob.find(@repository, @commit.id, @path)
+ @blob = @repository.blob_at(@commit.id, @path)
if @blob
type = if @blob.mime_type =~ /html|javascript/