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
Léo-Paul Géneau
gitlab-ce
Commits
8243eb3f
Commit
8243eb3f
authored
Jan 17, 2015
by
Hannes Rosenögger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show tags in commit view
parent
ada6c608
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
1 deletion
+32
-1
CHANGELOG
CHANGELOG
+1
-1
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+1
-0
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+6
-0
app/models/repository.rb
app/models/repository.rb
+17
-0
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+7
-0
No files found.
CHANGELOG
View file @
8243eb3f
...
@@ -11,7 +11,7 @@ v 7.8.0
...
@@ -11,7 +11,7 @@ v 7.8.0
-
-
-
-
-
-
-
-
Show tags in commit view (Hannes Rosenögger)
-
-
-
-
-
-
...
...
app/controllers/projects/commit_controller.rb
View file @
8243eb3f
...
@@ -12,6 +12,7 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -12,6 +12,7 @@ class Projects::CommitController < Projects::ApplicationController
@line_notes
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
inline
@line_notes
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
inline
@branches
=
@project
.
repository
.
branch_names_contains
(
commit
.
id
)
@branches
=
@project
.
repository
.
branch_names_contains
(
commit
.
id
)
@tags
=
@project
.
repository
.
tag_names_contains
(
commit
.
id
)
@diffs
=
@commit
.
diffs
@diffs
=
@commit
.
diffs
@note
=
@project
.
build_commit_note
(
commit
)
@note
=
@project
.
build_commit_note
(
commit
)
@notes_count
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
count
@notes_count
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
count
...
...
app/helpers/commits_helper.rb
View file @
8243eb3f
...
@@ -65,6 +65,12 @@ module CommitsHelper
...
@@ -65,6 +65,12 @@ module CommitsHelper
branches
.
sort
.
map
{
|
branch
|
link_to
(
branch
,
project_tree_path
(
project
,
branch
))
}.
join
(
", "
).
html_safe
branches
.
sort
.
map
{
|
branch
|
link_to
(
branch
,
project_tree_path
(
project
,
branch
))
}.
join
(
", "
).
html_safe
end
end
# Returns the sorted links to tags, separated by a comma
def
commit_tags_links
(
project
,
tags
)
sorted
=
VersionSorter
.
rsort
(
tags
)
sorted
.
map
{
|
tag
|
link_to
(
tag
,
project_commits_path
(
project
,
project
.
repository
.
find_tag
(
tag
).
name
))
}.
join
(
", "
).
html_safe
end
def
link_to_browse_code
(
project
,
commit
)
def
link_to_browse_code
(
project
,
commit
)
if
current_controller?
(
:projects
,
:commits
)
if
current_controller?
(
:projects
,
:commits
)
if
@repo
.
blob_at
(
commit
.
id
,
@path
)
if
@repo
.
blob_at
(
commit
.
id
,
@path
)
...
...
app/models/repository.rb
View file @
8243eb3f
...
@@ -312,4 +312,21 @@ class Repository
...
@@ -312,4 +312,21 @@ class Repository
[]
[]
end
end
end
end
def
tag_names_contains
(
sha
)
args
=
%W(git tag --contains
#{
sha
}
)
names
=
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
).
first
if
names
.
respond_to?
(
:split
)
names
=
names
.
split
(
"
\n
"
).
map
(
&
:strip
)
names
.
each
do
|
name
|
name
.
slice!
'* '
end
names
else
[]
end
end
end
end
app/views/projects/commit/_commit_box.html.haml
View file @
8243eb3f
...
@@ -50,6 +50,13 @@
...
@@ -50,6 +50,13 @@
%span
.js-details-content.hide
%span
.js-details-content.hide
=
commit_branches_links
(
@project
,
@branches
)
=
commit_branches_links
(
@project
,
@branches
)
-
if
@tags
.
any?
.commit-info-row
%span
.cgray
Tags:
%span
=
commit_tags_links
(
@project
,
@tags
)
.commit-box
.commit-box
%h3
.commit-title
%h3
.commit-title
=
gfm
escape_once
(
@commit
.
title
)
=
gfm
escape_once
(
@commit
.
title
)
...
...
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