BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a518879a
Commit
a518879a
authored
Dec 01, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9868 from yms9654/commit-without-whitespace
Add ignore whitespace change option to commit view
parents
ceeb93fa
8c4a3c77
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
CHANGELOG
CHANGELOG
+1
-0
commit_controller.rb
app/controllers/projects/commit_controller.rb
+6
-1
commit_controller_spec.rb
spec/controllers/commit_controller_spec.rb
+15
-0
No files found.
CHANGELOG
View file @
a518879a
...
...
@@ -4,6 +4,7 @@ v 8.3.0 (unreleased)
- Fix: Assignee selector is empty when 'Unassigned' is selected (Jose Corcuera)
- Fix 500 error when update group member permission
- Trim leading and trailing whitespace of milestone and issueable titles (Jose Corcuera)
- Add ignore whitespace change option to commit view
v 8.2.2
- Fix 404 in redirection after removing a project (Stan Hu)
...
...
app/controllers/projects/commit_controller.rb
View file @
a518879a
...
...
@@ -67,7 +67,12 @@ class Projects::CommitController < Projects::ApplicationController
end
def
define_show_vars
@diffs
=
commit
.
diffs
if
params
[
:w
].
to_i
==
1
@diffs
=
commit
.
diffs
({
ignore_whitespace_change:
true
})
else
@diffs
=
commit
.
diffs
end
@notes_count
=
commit
.
notes
.
count
@builds
=
ci_commit
.
builds
if
ci_commit
...
...
spec/controllers/commit_controller_spec.rb
View file @
a518879a
...
...
@@ -69,6 +69,21 @@ describe Projects::CommitController do
expect
(
response
.
body
).
to
start_with
(
"diff --git"
)
end
it
"should really only be a git diff without whitespace changes"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
'66eceea0db202bb39c4e445e8ca28689645366c5'
,
# id: commit.id,
format:
format
,
w:
1
)
expect
(
response
.
body
).
to
start_with
(
"diff --git"
)
# without whitespace option, there are more than 2 diff_splits
diff_splits
=
assigns
(
:diffs
)[
0
].
diff
.
split
(
"
\n
"
)
expect
(
diff_splits
.
length
).
to
be
<=
2
end
end
describe
"as patch"
do
...
...
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