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
1e1c5b7a
Commit
1e1c5b7a
authored
Jun 24, 2012
by
Valeriy Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Diff refactoring
parent
279c4262
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+5
-5
app/views/commits/_text_file.html.haml
app/views/commits/_text_file.html.haml
+1
-1
No files found.
app/helpers/commits_helper.rb
View file @
1e1c5b7a
...
...
@@ -17,7 +17,7 @@ module CommitsHelper
preserve
out
end
def
diff_line_class
(
line
)
def
identification_type
(
line
)
if
line
[
0
]
==
"+"
"new"
elsif
line
[
0
]
==
"-"
...
...
@@ -27,7 +27,7 @@ module CommitsHelper
end
end
def
build_line_
code
(
line
,
index
,
line_new
,
line_old
)
def
build_line_
anchor
(
index
,
line_new
,
line_old
)
"
#{
index
}
_
#{
line_old
}
_
#{
line_new
}
"
end
...
...
@@ -51,12 +51,12 @@ module CommitsHelper
line_old
=
line
.
match
(
/\-[0-9]*/
)[
0
].
to_i
.
abs
rescue
0
line_new
=
line
.
match
(
/\+[0-9]*/
)[
0
].
to_i
.
abs
rescue
0
next
if
line_old
==
1
&&
line_new
==
1
next
if
line_old
==
1
&&
line_new
==
1
#top of file
yield
(
full_line
,
type
,
nil
,
nil
,
nil
)
next
else
type
=
diff_line_class
(
line
)
line_code
=
build_line_
code
(
line
,
index
,
line_new
,
line_old
)
type
=
identification_type
(
line
)
line_code
=
build_line_
anchor
(
index
,
line_new
,
line_old
)
yield
(
full_line
,
type
,
line_code
,
line_new
,
line_old
)
end
...
...
app/views/commits/_text_file.html.haml
View file @
1e1c5b7a
-
too_big
=
max_lines
=
diff
.
diff
.
lines
.
count
>
1000
-
too_big
=
diff
.
diff
.
lines
.
count
>
1000
-
if
too_big
%a
.supp_diff_link
Diff suppressed. Click to show
...
...
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