summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2012-09-16 16:21:46 -0400
committerRobert Speicher <rspeicher@gmail.com>2012-09-26 16:32:20 -0400
commited26ecae0c3303b5554b033abd6f0a078b7573c0 (patch)
tree57632c344816f3478b9ac25df34e5b317fe75700 /app
parent0439387be00bfb862b4454000f805f11fb8cc389 (diff)
downloadgitlab-ce-ed26ecae0c3303b5554b033abd6f0a078b7573c0.tar.gz
Add branches method to Repository role
Diffstat (limited to 'app')
-rw-r--r--app/roles/repository.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/app/roles/repository.rb b/app/roles/repository.rb
index 01156ac18b7..7118f156f75 100644
--- a/app/roles/repository.rb
+++ b/app/roles/repository.rb
@@ -45,8 +45,16 @@ module Repository
File.exists?(hook_file)
end
+ def branches
+ repo.branches.collect(&:name).sort
+ end
+
def tags
- repo.tags.map(&:name).sort.reverse
+ repo.tags.collect(&:name).sort.reverse
+ end
+
+ def ref_names
+ [branches + tags].flatten
end
def repo
@@ -79,14 +87,6 @@ module Repository
@heads ||= repo.heads
end
- def branches_names
- heads.map(&:name)
- end
-
- def ref_names
- [branches_names + tags].flatten
- end
-
def tree(fcommit, path = nil)
fcommit = commit if fcommit == :head
tree = fcommit.tree
@@ -109,8 +109,6 @@ module Repository
# - If two or more branches are present, returns the one that has a name
# matching root_ref (default_branch or 'master' if default_branch is nil)
def discover_default_branch
- branches = heads.collect(&:name)
-
if branches.length == 0
nil
elsif branches.length == 1