Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
f8c02f6e
Commit
f8c02f6e
authored
Sep 26, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add branches and tags Repo methods
Simplifies the actions in RepositoriesController
parent
2df3b310
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
app/controllers/repositories_controller.rb
app/controllers/repositories_controller.rb
+2
-2
app/roles/repository.rb
app/roles/repository.rb
+10
-0
No files found.
app/controllers/repositories_controller.rb
View file @
f8c02f6e
...
@@ -14,11 +14,11 @@ class RepositoriesController < ApplicationController
...
@@ -14,11 +14,11 @@ class RepositoriesController < ApplicationController
end
end
def
branches
def
branches
@branches
=
@project
.
repo
.
heads
.
sort_by
(
&
:name
)
@branches
=
@project
.
branches
end
end
def
tags
def
tags
@tags
=
@project
.
repo
.
tags
.
sort_by
(
&
:name
).
reverse
@tags
=
@project
.
tags
end
end
def
archive
def
archive
...
...
app/roles/repository.rb
View file @
f8c02f6e
...
@@ -50,11 +50,21 @@ module Repository
...
@@ -50,11 +50,21 @@ module Repository
repo
.
branches
.
collect
(
&
:name
).
sort
repo
.
branches
.
collect
(
&
:name
).
sort
end
end
# Returns an Array of Branches
def
branches
repo
.
branches
.
sort_by
(
&
:name
)
end
# Returns an Array of tag names
# Returns an Array of tag names
def
tag_names
def
tag_names
repo
.
tags
.
collect
(
&
:name
).
sort
.
reverse
repo
.
tags
.
collect
(
&
:name
).
sort
.
reverse
end
end
# Returns an Array of Tags
def
tags
repo
.
tags
.
sort_by
(
&
:name
).
reverse
end
# Returns an Array of branch and tag names
# Returns an Array of branch and tag names
def
ref_names
def
ref_names
[
branch_names
+
tag_names
].
flatten
[
branch_names
+
tag_names
].
flatten
...
...
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