BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ed26ecae
Commit
ed26ecae
authored
Sep 16, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add branches method to Repository role
parent
0439387b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
repository.rb
app/roles/repository.rb
+9
-11
No files found.
app/roles/repository.rb
View file @
ed26ecae
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment