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
1c4187e3
Commit
1c4187e3
authored
Oct 02, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Treat nil git push revisons as a blank Git SHA value
parent
9bad9b0a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
lib/gitlab/git/push.rb
lib/gitlab/git/push.rb
+2
-2
spec/lib/gitlab/git/push_spec.rb
spec/lib/gitlab/git/push_spec.rb
+38
-0
No files found.
lib/gitlab/git/push.rb
View file @
1c4187e3
...
@@ -9,8 +9,8 @@ module Gitlab
...
@@ -9,8 +9,8 @@ module Gitlab
def
initialize
(
project
,
oldrev
,
newrev
,
ref
)
def
initialize
(
project
,
oldrev
,
newrev
,
ref
)
@project
=
project
@project
=
project
@oldrev
=
oldrev
@oldrev
=
oldrev
.
presence
||
Gitlab
::
Git
::
BLANK_SHA
@newrev
=
newrev
@newrev
=
newrev
.
presence
||
Gitlab
::
Git
::
BLANK_SHA
@ref
=
ref
@ref
=
ref
end
end
...
...
spec/lib/gitlab/git/push_spec.rb
View file @
1c4187e3
...
@@ -63,6 +63,12 @@ describe Gitlab::Git::Push do
...
@@ -63,6 +63,12 @@ describe Gitlab::Git::Push do
it
{
is_expected
.
not_to
be_branch_updated
}
it
{
is_expected
.
not_to
be_branch_updated
}
end
end
context
'when oldrev is nil'
do
let
(
:oldrev
)
{
nil
}
it
{
is_expected
.
not_to
be_branch_updated
}
end
end
end
describe
'#force_push?'
do
describe
'#force_push?'
do
...
@@ -125,4 +131,36 @@ describe Gitlab::Git::Push do
...
@@ -125,4 +131,36 @@ describe Gitlab::Git::Push do
end
end
end
end
end
end
describe
'#oldrev'
do
context
'when a valid oldrev is provided'
do
it
'returns oldrev'
do
expect
(
subject
.
oldrev
).
to
eq
oldrev
end
end
context
'when a nil valud is provided'
do
let
(
:oldrev
)
{
nil
}
it
'returns blank SHA'
do
expect
(
subject
.
oldrev
).
to
eq
Gitlab
::
Git
::
BLANK_SHA
end
end
end
describe
'#newrev'
do
context
'when valid newrev is provided'
do
it
'returns newrev'
do
expect
(
subject
.
newrev
).
to
eq
newrev
end
end
context
'when a nil valud is provided'
do
let
(
:newrev
)
{
nil
}
it
'returns blank SHA'
do
expect
(
subject
.
newrev
).
to
eq
Gitlab
::
Git
::
BLANK_SHA
end
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