Commit f8c02f6e authored by Robert Speicher's avatar Robert Speicher

Add branches and tags Repo methods

Simplifies the actions in RepositoriesController
parent 2df3b310
......@@ -14,11 +14,11 @@ class RepositoriesController < ApplicationController
end
def branches
@branches = @project.repo.heads.sort_by(&:name)
@branches = @project.branches
end
def tags
@tags = @project.repo.tags.sort_by(&:name).reverse
@tags = @project.tags
end
def archive
......
......@@ -50,11 +50,21 @@ module Repository
repo.branches.collect(&:name).sort
end
# Returns an Array of Branches
def branches
repo.branches.sort_by(&:name)
end
# Returns an Array of tag names
def tag_names
repo.tags.collect(&:name).sort.reverse
end
# Returns an Array of Tags
def tags
repo.tags.sort_by(&:name).reverse
end
# Returns an Array of branch and tag names
def ref_names
[branch_names + tag_names].flatten
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment