summaryrefslogtreecommitdiff
path: root/app/controllers/projects/tree_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/tree_controller.rb')
-rw-r--r--app/controllers/projects/tree_controller.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb
index 30181ac3bdf..1fc276b8c03 100644
--- a/app/controllers/projects/tree_controller.rb
+++ b/app/controllers/projects/tree_controller.rb
@@ -24,12 +24,19 @@ class Projects::TreeController < Projects::ApplicationController
end
end
- @last_commit = @repository.last_commit_for_path(@commit.id, @tree.path) || @commit
-
respond_to do |format|
- format.html
- # Disable cache so browser history works
- format.js { no_cache_headers }
+ format.html do
+ @last_commit = @repository.last_commit_for_path(@commit.id, @tree.path) || @commit
+ end
+
+ format.js do
+ # Disable cache so browser history works
+ no_cache_headers
+ end
+
+ format.json do
+ render json: TreeSerializer.new(project: @project, repository: @repository, ref: @ref).represent(@tree)
+ end
end
end