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
96ed5c51
Commit
96ed5c51
authored
Feb 22, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure we don't check a commit's description for revert message if it has no description
parent
96ce80d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
commit.rb
app/models/commit.rb
+1
-1
commit_spec.rb
spec/models/commit_spec.rb
+34
-0
No files found.
app/models/commit.rb
View file @
96ed5c51
...
@@ -232,7 +232,7 @@ class Commit
...
@@ -232,7 +232,7 @@ class Commit
end
end
def
reverts_commit?
(
commit
)
def
reverts_commit?
(
commit
)
description
.
include?
(
commit
.
revert_description
)
description
?
&&
description
.
include?
(
commit
.
revert_description
)
end
end
def
merge_commit?
def
merge_commit?
...
...
spec/models/commit_spec.rb
View file @
96ed5c51
...
@@ -118,4 +118,38 @@ eos
...
@@ -118,4 +118,38 @@ eos
it
{
expect
(
data
[
:modified
]).
to
eq
([
".gitmodules"
])
}
it
{
expect
(
data
[
:modified
]).
to
eq
([
".gitmodules"
])
}
it
{
expect
(
data
[
:removed
]).
to
eq
([])
}
it
{
expect
(
data
[
:removed
]).
to
eq
([])
}
end
end
describe
'#reverts_commit?'
do
let
(
:another_commit
)
{
double
(
:commit
,
revert_description:
"This reverts commit
#{
commit
.
sha
}
"
)
}
it
{
expect
(
commit
.
reverts_commit?
(
another_commit
)).
to
be_falsy
}
context
'commit has no description'
do
before
{
allow
(
commit
).
to
receive
(
:description?
).
and_return
(
false
)
}
it
{
expect
(
commit
.
reverts_commit?
(
another_commit
)).
to
be_falsy
}
end
context
"another_commit's description does not revert commit"
do
before
{
allow
(
commit
).
to
receive
(
:description
).
and_return
(
"Foo Bar"
)
}
it
{
expect
(
commit
.
reverts_commit?
(
another_commit
)).
to
be_falsy
}
end
context
"another_commit's description reverts commit"
do
before
{
allow
(
commit
).
to
receive
(
:description
).
and_return
(
"Foo
#{
another_commit
.
revert_description
}
Bar"
)
}
it
{
expect
(
commit
.
reverts_commit?
(
another_commit
)).
to
be_truthy
}
end
context
"another_commit's description reverts merged merge request"
do
before
do
revert_description
=
"This reverts merge request !foo123"
allow
(
another_commit
).
to
receive
(
:revert_description
).
and_return
(
revert_description
)
allow
(
commit
).
to
receive
(
:description
).
and_return
(
"Foo
#{
another_commit
.
revert_description
}
Bar"
)
end
it
{
expect
(
commit
.
reverts_commit?
(
another_commit
)).
to
be_truthy
}
end
end
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