Skip to content

Commit

Permalink
Make trees controller handle empty repos, sorta... [#170]
Browse files Browse the repository at this point in the history
  • Loading branch information
jesjos committed Jun 3, 2012
1 parent a2374cd commit e5f806e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/controllers/trees_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ def index
def show
@repository = Repository.find(params[:repository_id])
@git = @repository.git

if @git.branches.empty?
@lhg = LabHasGroup.where(repository_id: @repository.id).first
render partial: "empty"
return
end

@ref, @path = branch_and_path(params[:branch_and_path], @git)
unless @commit = @git.commit(@ref)
handle_missing_tree_sha and return
Expand Down
9 changes: 9 additions & 0 deletions app/views/trees/_empty.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.well
%h2
This lab is currently empty.
%p
You can add data to it either by uploading files, or by accessing the lab through git.
%p
Your git clone url:
%pre
= @lhg.http_clone_uri

0 comments on commit e5f806e

Please sign in to comment.