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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
7b38fbee
Commit
7b38fbee
authored
Dec 30, 2021
by
Piotr Stankowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore new line differences when deciding whether to squash MR
Changelog: fixed
parent
eced6f27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
app/services/merge_requests/squash_service.rb
app/services/merge_requests/squash_service.rb
+1
-1
spec/services/merge_requests/squash_service_spec.rb
spec/services/merge_requests/squash_service_spec.rb
+16
-0
No files found.
app/services/merge_requests/squash_service.rb
View file @
7b38fbee
...
...
@@ -5,7 +5,7 @@ module MergeRequests
def
execute
# If performing a squash would result in no change, then
# immediately return a success message without performing a squash
if
merge_request
.
commits_count
==
1
&&
message
==
merge_request
.
first_commit
.
safe_message
if
merge_request
.
commits_count
==
1
&&
message
&
.
strip
==
merge_request
.
first_commit
.
safe_message
&
.
strip
return
success
(
squash_sha:
merge_request
.
diff_head_sha
)
end
...
...
spec/services/merge_requests/squash_service_spec.rb
View file @
7b38fbee
...
...
@@ -76,6 +76,22 @@ RSpec.describe MergeRequests::SquashService do
service
.
execute
end
end
context
'when squash message matches commit message but without trailing new line'
do
let
(
:service
)
{
described_class
.
new
(
project:
project
,
current_user:
user
,
params:
{
merge_request:
merge_request
,
squash_commit_message:
merge_request
.
first_commit
.
safe_message
.
strip
})
}
it
'returns that commit SHA'
do
result
=
service
.
execute
expect
(
result
).
to
match
(
status: :success
,
squash_sha:
merge_request
.
diff_head_sha
)
end
it
'does not perform any git actions'
do
expect
(
repository
).
not_to
receive
(
:squash
)
service
.
execute
end
end
end
context
'the squashed commit'
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