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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
...
@@ -17,7 +17,7 @@ module CommitsHelper
preserve
out
preserve
out
end
end
def
diff_line_class
(
line
)
def
identification_type
(
line
)
if
line
[
0
]
==
"+"
if
line
[
0
]
==
"+"
"new"
"new"
elsif
line
[
0
]
==
"-"
elsif
line
[
0
]
==
"-"
...
@@ -27,7 +27,7 @@ module CommitsHelper
...
@@ -27,7 +27,7 @@ module CommitsHelper
end
end
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
}
"
"
#{
index
}
_
#{
line_old
}
_
#{
line_new
}
"
end
end
...
@@ -51,12 +51,12 @@ module CommitsHelper
...
@@ -51,12 +51,12 @@ module CommitsHelper
line_old
=
line
.
match
(
/\-[0-9]*/
)[
0
].
to_i
.
abs
rescue
0
line_old
=
line
.
match
(
/\-[0-9]*/
)[
0
].
to_i
.
abs
rescue
0
line_new
=
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
)
yield
(
full_line
,
type
,
nil
,
nil
,
nil
)
next
next
else
else
type
=
diff_line_class
(
line
)
type
=
identification_type
(
line
)
line_code
=
build_line_
code
(
line
,
index
,
line_new
,
line_old
)
line_code
=
build_line_
anchor
(
index
,
line_new
,
line_old
)
yield
(
full_line
,
type
,
line_code
,
line_new
,
line_old
)
yield
(
full_line
,
type
,
line_code
,
line_new
,
line_old
)
end
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
-
if
too_big
%a
.supp_diff_link
Diff suppressed. Click to show
%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