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
Tatuya Kamada
gitlab-ce
Commits
016012b1
Commit
016012b1
authored
Oct 24, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed: Commit message encoding error
parent
ba8048d7
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
24 additions
and
20 deletions
+24
-20
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+0
-9
app/views/commits/_commits.html.haml
app/views/commits/_commits.html.haml
+1
-1
app/views/commits/show.html.haml
app/views/commits/show.html.haml
+1
-1
app/views/projects/_recent_commits.html.haml
app/views/projects/_recent_commits.html.haml
+1
-1
app/views/projects/_recent_messages.html.haml
app/views/projects/_recent_messages.html.haml
+1
-1
app/views/projects/_tree.html.haml
app/views/projects/_tree.html.haml
+4
-4
app/views/projects/_tree_file.html.haml
app/views/projects/_tree_file.html.haml
+2
-2
app/views/projects/_tree_item.html.haml
app/views/projects/_tree_item.html.haml
+1
-1
config/initializers/grit_ext.rb
config/initializers/grit_ext.rb
+4
-0
lib/commit_ext.rb
lib/commit_ext.rb
+9
-0
No files found.
app/helpers/commits_helper.rb
View file @
016012b1
...
...
@@ -21,13 +21,4 @@ module CommitsHelper
link_to
"More"
,
project_commits_path
(
@project
,
:offset
=>
offset
.
to_i
+
limit
.
to_i
,
:limit
=>
limit
),
:remote
=>
true
,
:class
=>
"lite_button vm"
,
:style
=>
"text-align:center; width:930px; "
,
:id
=>
"more-commits-link"
end
# Cause some errors with trucate & encoding use this method
def
truncate_commit_message
(
commit
,
size
=
60
)
message
=
commit
.
message
message
.
length
>
size
?
(
message
[
0
..
(
size
-
1
)]
+
"..."
)
:
message
# if special characters occurs
rescue
commit
.
message
end
end
app/views/commits/_commits.html.haml
View file @
016012b1
...
...
@@ -11,7 +11,7 @@
=
image_tag
"no_avatar.png"
,
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
%p
%strong
=
truncate_commit_message
(
commit
)
=
commit
.
truncated_message
=
link_to
"Browse Code"
,
tree_project_path
(
@project
,
:commit_id
=>
commit
.
id
),
:class
=>
"lite_button"
,
:style
=>
"float:right"
=
link_to
truncate
(
commit
.
id
.
to_s
,
:length
=>
16
),
project_commit_path
(
@project
,
:id
=>
commit
.
id
),
:class
=>
"lite_button"
,
:style
=>
"width:120px;float:right"
%span
...
...
app/views/commits/show.html.haml
View file @
016012b1
%h3
=
"[
#{
@commit
.
committer
}
]
#{
truncate_commit_message
(
@commit
,
8
0
)
}
"
=
"[
#{
@commit
.
committer
}
]
#{
@commit
.
truncated_message
(
4
0
)
}
"
-#= link_to 'Back', project_commits_path(@project), :class => "button"
%table
.round-borders
%tr
...
...
app/views/projects/_recent_commits.html.haml
View file @
016012b1
...
...
@@ -6,7 +6,7 @@
=
image_tag
"no_avatar.png"
,
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
%p
{
:style
=>
"margin-bottom: 3px;"
}
%strong
=
link_to
truncate_commit_message
(
commit
,
60
),
project_commit_path
(
@project
,
:id
=>
commit
.
id
)
=
link_to
commit
.
truncated_message
(
60
),
project_commit_path
(
@project
,
:id
=>
commit
.
id
)
%span
%span
.author
...
...
app/views/projects/_recent_messages.html.haml
View file @
016012b1
...
...
@@ -19,7 +19,7 @@
-
css_class
=
"dash_commit"
-
commit
=
parent
-
item_code
=
commit
.
author
.
email
-
link_item_name
=
truncate_commit_message
(
commit
,
50
)
-
link_item_name
=
commit
.
truncated_message
(
50
)
-
link_to_item
=
project_commit_path
(
@project
,
:id
=>
commit
.
id
)
-
else
-
css_class
=
"dash_wall"
...
...
app/views/projects/_tree.html.haml
View file @
016012b1
...
...
@@ -30,15 +30,15 @@
%th
Last Update
%th
Last commit
=
link_to
"history"
,
project_commits_path
(
@project
,
:path
=>
params
[
:path
]),
:class
=>
"right"
=
link_to
"history"
,
project_commits_path
(
@project
,
:path
=>
params
[
:path
]
,
:branch
=>
params
[
:branch
],
:tag
=>
params
[
:tag
]
),
:class
=>
"right"
-
if
params
[
:path
]
-
file
=
File
.
join
(
params
[
:path
],
".."
)
%tr
{
:class
=>
"tree-item"
,
:url
=>
tree_file_project_path
(
@project
,
@commit
.
id
,
file
)
}
%td
.tree-item-file-name
=
image_tag
"dir.png"
=
link_to
".."
,
tree_file_project_path
(
@project
,
@commit
.
id
,
file
,
:branch
=>
@branch
,
:tag
=>
@tag
),
:remote
=>
:true
%td
%td
%td
%td
-
contents
.
select
{
|
i
|
i
.
is_a?
(
Grit
::
Tree
)}.
each
do
|
content
|
=
render
:partial
=>
"projects/tree_item"
,
:locals
=>
{
:content
=>
content
}
...
...
@@ -52,7 +52,7 @@
});
-
if
params
[
:path
]
&&
request
.
xhr?
:javascript
:javascript
$
(
window
).
unbind
(
'
popstate
'
);
$
(
window
).
bind
(
'
popstate
'
,
function
()
{
if
(
location
.
pathname
.
search
(
"
tree
"
)
!=
-
1
)
{
...
...
app/views/projects/_tree_file.html.haml
View file @
016012b1
...
...
@@ -4,7 +4,7 @@
%strong
=
name
=
link_to
"raw"
,
blob_project_path
(
@project
,
:commit_id
=>
@commit
.
id
,
:path
=>
params
[
:path
]
),
:class
=>
"right"
,
:target
=>
"_blank"
=
link_to
"history"
,
project_commits_path
(
@project
,
:path
=>
params
[
:path
]),
:class
=>
"right"
,
:style
=>
"margin-right:10px;"
=
link_to
"history"
,
project_commits_path
(
@project
,
:path
=>
params
[
:path
]
,
:branch
=>
params
[
:branch
],
:tag
=>
params
[
:tag
]
),
:class
=>
"right"
,
:style
=>
"margin-right:10px;"
%br
/
-
if
file
.
text?
.view_file_content
...
...
@@ -14,6 +14,6 @@
.view_file_content_image
%img
{
:src
=>
"data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"
}
-
else
%p
%p
%center
No preview for this file type
app/views/projects/_tree_item.html.haml
View file @
016012b1
...
...
@@ -12,4 +12,4 @@
=
time_ago_in_words
(
content_commit
.
committed_date
)
ago
%td
=
link_to
truncate_commit_message
(
content_commit
,
40
),
project_commit_path
(
@project
,
content_commit
)
=
link_to
content_commit
.
truncated_message
(
40
),
project_commit_path
(
@project
,
content_commit
)
config/initializers/grit_ext.rb
View file @
016012b1
...
...
@@ -6,3 +6,7 @@ Grit::Blob.class_eval do
include
Utils
::
FileHelper
include
Utils
::
Colorize
end
Grit
::
Commit
.
class_eval
do
include
CommitExt
end
lib/commit_ext.rb
0 → 100644
View file @
016012b1
module
CommitExt
# Cause of encoding rails truncate raise error
# this method is temporary decision
def
truncated_message
(
size
=
80
)
message
.
length
>
size
?
(
message
[
0
..
(
size
-
1
)]
+
"..."
)
:
message
rescue
"-- invalid encoding for commit message"
end
end
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