Controller for viewing a repository’s file structure

Methods
E
S
U
Included Modules
Instance Public methods
edit()
# File app/controllers/tree_controller.rb, line 24
def edit
  @last_commit = @project.last_commit_for(@ref, @path).sha
end
show()
# File app/controllers/tree_controller.rb, line 13
def show
  @hex_path  = Digest::SHA1.hexdigest(@path)
  @logs_path = logs_file_project_ref_path(@project, @ref, @path)

  respond_to do |format|
    format.html
    # Disable cache so browser history works
    format.js { no_cache_headers }
  end
end
update()
# File app/controllers/tree_controller.rb, line 28
def update
  edit_file_action = Gitlab::Satellite::EditFileAction.new(current_user, @project, @ref, @path)
  updated_successfully = edit_file_action.commit!(
    params[:content],
    params[:commit_message],
    params[:last_commit]
  )

  if updated_successfully
    redirect_to project_tree_path(@project, @id), notice: "Your changes have been successfully commited"
  else
    flash[:notice] = "Your changes could not be commited, because the file has been changed"
    render :edit
  end
end