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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
daa0137b
Commit
daa0137b
authored
Aug 09, 2017
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate force push check to Gitaly
parent
8d2099cd
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
13 deletions
+24
-13
GITALY_SERVER_VERSION
GITALY_SERVER_VERSION
+1
-1
Gemfile
Gemfile
+1
-1
Gemfile.lock
Gemfile.lock
+2
-2
lib/gitlab/checks/force_push.rb
lib/gitlab/checks/force_push.rb
+13
-6
lib/gitlab/gitaly_client/util.rb
lib/gitlab/gitaly_client/util.rb
+3
-1
spec/lib/gitlab/checks/force_push_spec.rb
spec/lib/gitlab/checks/force_push_spec.rb
+1
-1
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+3
-1
No files found.
GITALY_SERVER_VERSION
View file @
daa0137b
0.
29
.0
0.
30
.0
Gemfile
View file @
daa0137b
...
...
@@ -402,7 +402,7 @@ group :ed25519 do
end
# Gitaly GRPC client
gem
'
gitaly
'
,
'~> 0.2
6
.0'
gem
'
gitaly
'
,
'~> 0.2
7
.0'
gem
'
toml-rb
'
,
'~> 0.3.15'
,
require:
false
...
...
Gemfile.lock
View file @
daa0137b
...
...
@@ -270,7 +270,7 @@ GEM
po_to_json (>= 1.0.0)
rails (>= 3.2.0)
gherkin-ruby (0.3.2)
gitaly (0.2
6
.0)
gitaly (0.2
7
.0)
google-protobuf (~> 3.1)
grpc (~> 1.0)
github-linguist (4.7.6)
...
...
@@ -983,7 +983,7 @@ DEPENDENCIES
gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.2.0)
gitaly (~> 0.2
6
.0)
gitaly (~> 0.2
7
.0)
github-linguist (~> 4.7.0)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-markup (~> 1.5.1)
...
...
lib/gitlab/checks/force_push.rb
View file @
daa0137b
...
...
@@ -5,8 +5,14 @@ module Gitlab
return
false
if
project
.
empty_repo?
# Created or deleted branch
if
Gitlab
::
Git
.
blank_ref?
(
oldrev
)
||
Gitlab
::
Git
.
blank_ref?
(
newrev
)
false
return
false
if
Gitlab
::
Git
.
blank_ref?
(
oldrev
)
||
Gitlab
::
Git
.
blank_ref?
(
newrev
)
GitalyClient
.
migrate
(
:force_push
)
do
|
is_enabled
|
if
is_enabled
!
project
.
repository
.
gitaly_commit_client
.
is_ancestor
(
oldrev
,
newrev
)
else
Gitlab
::
Git
::
RevList
.
new
(
path_to_repo:
project
.
repository
.
path_to_repo
,
...
...
@@ -15,4 +21,5 @@ module Gitlab
end
end
end
end
end
lib/gitlab/gitaly_client/util.rb
View file @
daa0137b
...
...
@@ -5,7 +5,9 @@ module Gitlab
def
repository
(
repository_storage
,
relative_path
)
Gitaly
::
Repository
.
new
(
storage_name:
repository_storage
,
relative_path:
relative_path
relative_path:
relative_path
,
git_object_directory:
Gitlab
::
Git
::
Env
[
'GIT_OBJECT_DIRECTORY'
].
to_s
,
git_alternate_object_directories:
Array
.
wrap
(
Gitlab
::
Git
::
Env
[
'GIT_ALTERNATE_OBJECT_DIRECTORIES'
])
)
end
end
...
...
spec/lib/gitlab/checks/force_push_spec.rb
View file @
daa0137b
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Checks
::
ForcePush
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
"exit code checking"
do
context
"exit code checking"
,
skip_gitaly_mock:
true
do
it
"does not raise a runtime error if the `popen` call to git returns a zero exit code"
do
allow
(
Gitlab
::
Popen
).
to
receive
(
:popen
).
and_return
([
'normal output'
,
0
])
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
daa0137b
...
...
@@ -217,7 +217,9 @@ describe Gitlab::Workhorse do
it
'includes a Repository param'
do
repo_param
=
{
Repository
:
{
storage_name:
'default'
,
relative_path:
project
.
full_path
+
'.git'
relative_path:
project
.
full_path
+
'.git'
,
git_object_directory:
''
,
git_alternate_object_directories:
[]
}
}
expect
(
subject
).
to
include
(
repo_param
)
...
...
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