diff --git a/app/controllers/trees_controller.rb b/app/controllers/trees_controller.rb index c130347e..e053b5bf 100644 --- a/app/controllers/trees_controller.rb +++ b/app/controllers/trees_controller.rb @@ -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 diff --git a/app/views/trees/_empty.haml b/app/views/trees/_empty.haml new file mode 100644 index 00000000..a9afdf48 --- /dev/null +++ b/app/views/trees/_empty.haml @@ -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 \ No newline at end of file