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
3f0e6d92
Commit
3f0e6d92
authored
Jul 27, 2018
by
Jacob Vosmaer (GitLab)
Committed by
Sean McGivern
Jul 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Gitaly cleanup: fetch_ref, allow disk access blocks
parent
835bacc2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
33 deletions
+17
-33
lib/gitlab/git/conflict/resolver.rb
lib/gitlab/git/conflict/resolver.rb
+1
-1
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+6
-24
lib/gitlab/git/repository_mirroring.rb
lib/gitlab/git/repository_mirroring.rb
+3
-1
lib/gitlab/import_export/merge_request_parser.rb
lib/gitlab/import_export/merge_request_parser.rb
+5
-1
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+1
-5
No files found.
lib/gitlab/git/conflict/resolver.rb
View file @
3f0e6d92
...
@@ -17,7 +17,7 @@ module Gitlab
...
@@ -17,7 +17,7 @@ module Gitlab
end
end
rescue
GRPC
::
FailedPrecondition
=>
e
rescue
GRPC
::
FailedPrecondition
=>
e
raise
Gitlab
::
Git
::
Conflict
::
Resolver
::
ConflictSideMissing
.
new
(
e
.
message
)
raise
Gitlab
::
Git
::
Conflict
::
Resolver
::
ConflictSideMissing
.
new
(
e
.
message
)
rescue
Rugged
::
ReferenceError
,
Rugged
::
OdbError
,
GRPC
::
BadStatus
=>
e
rescue
GRPC
::
BadStatus
=>
e
raise
Gitlab
::
Git
::
CommandError
.
new
(
e
)
raise
Gitlab
::
Git
::
CommandError
.
new
(
e
)
end
end
...
...
lib/gitlab/git/repository.rb
View file @
3f0e6d92
...
@@ -558,7 +558,9 @@ module Gitlab
...
@@ -558,7 +558,9 @@ module Gitlab
if
is_enabled
if
is_enabled
gitaly_operation_client
.
user_update_branch
(
branch_name
,
user
,
newrev
,
oldrev
)
gitaly_operation_client
.
user_update_branch
(
branch_name
,
user
,
newrev
,
oldrev
)
else
else
OperationService
.
new
(
user
,
self
).
update_branch
(
branch_name
,
newrev
,
oldrev
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
OperationService
.
new
(
user
,
self
).
update_branch
(
branch_name
,
newrev
,
oldrev
)
end
end
end
end
end
end
end
...
@@ -832,18 +834,9 @@ module Gitlab
...
@@ -832,18 +834,9 @@ module Gitlab
Gitlab
::
Git
.
check_namespace!
(
source_repository
)
Gitlab
::
Git
.
check_namespace!
(
source_repository
)
source_repository
=
RemoteRepository
.
new
(
source_repository
)
unless
source_repository
.
is_a?
(
RemoteRepository
)
source_repository
=
RemoteRepository
.
new
(
source_repository
)
unless
source_repository
.
is_a?
(
RemoteRepository
)
message
,
status
=
GitalyClient
.
migrate
(
:fetch_ref
)
do
|
is_enabled
|
args
=
%W(fetch --no-tags -f
#{
GITALY_INTERNAL_URL
}
#{
source_ref
}
:
#{
target_ref
}
)
if
is_enabled
message
,
status
=
run_git
(
args
,
env:
source_repository
.
fetch_env
)
gitaly_fetch_ref
(
source_repository
,
source_ref:
source_ref
,
target_ref:
target_ref
)
raise
Gitlab
::
Git
::
CommandError
,
message
if
status
!=
0
else
# When removing this code, also remove source_repository#path
# to remove deprecated method calls
local_fetch_ref
(
source_repository
.
path
,
source_ref:
source_ref
,
target_ref:
target_ref
)
end
end
# Make sure ref was created, and raise Rugged::ReferenceError when not
raise
Rugged
::
ReferenceError
,
message
if
status
!=
0
target_ref
target_ref
end
end
...
@@ -1244,17 +1237,6 @@ module Gitlab
...
@@ -1244,17 +1237,6 @@ module Gitlab
gitaly_repository_client
.
apply_gitattributes
(
revision
)
gitaly_repository_client
.
apply_gitattributes
(
revision
)
end
end
def
local_fetch_ref
(
source_path
,
source_ref
:,
target_ref
:)
args
=
%W(fetch --no-tags -f
#{
source_path
}
#{
source_ref
}
:
#{
target_ref
}
)
run_git
(
args
)
end
def
gitaly_fetch_ref
(
source_repository
,
source_ref
:,
target_ref
:)
args
=
%W(fetch --no-tags -f
#{
GITALY_INTERNAL_URL
}
#{
source_ref
}
:
#{
target_ref
}
)
run_git
(
args
,
env:
source_repository
.
fetch_env
)
end
def
gitaly_delete_refs
(
*
ref_names
)
def
gitaly_delete_refs
(
*
ref_names
)
gitaly_ref_client
.
delete_refs
(
refs:
ref_names
)
if
ref_names
.
any?
gitaly_ref_client
.
delete_refs
(
refs:
ref_names
)
if
ref_names
.
any?
end
end
...
...
lib/gitlab/git/repository_mirroring.rb
View file @
3f0e6d92
...
@@ -6,7 +6,9 @@ module Gitlab
...
@@ -6,7 +6,9 @@ module Gitlab
if
is_enabled
if
is_enabled
gitaly_ref_client
.
remote_branches
(
remote_name
)
gitaly_ref_client
.
remote_branches
(
remote_name
)
else
else
rugged_remote_branches
(
remote_name
)
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
rugged_remote_branches
(
remote_name
)
end
end
end
end
end
end
end
...
...
lib/gitlab/import_export/merge_request_parser.rb
View file @
3f0e6d92
...
@@ -27,7 +27,11 @@ module Gitlab
...
@@ -27,7 +27,11 @@ module Gitlab
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1295
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1295
def
fetch_ref
def
fetch_ref
@project
.
repository
.
fetch_ref
(
@project
.
repository
,
source_ref:
@diff_head_sha
,
target_ref:
@merge_request
.
source_branch
)
target_ref
=
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
@merge_request
.
source_branch
unless
@project
.
repository
.
fetch_source_branch!
(
@project
.
repository
,
@diff_head_sha
,
target_ref
)
Rails
.
logger
.
warn
(
"Import/Export warning: Failed to create
#{
target_ref
}
for MR:
#{
@merge_request
.
iid
}
"
)
end
end
end
def
branch_exists?
(
branch_name
)
def
branch_exists?
(
branch_name
)
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
3f0e6d92
...
@@ -16,7 +16,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
...
@@ -16,7 +16,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
@shared
=
@project
.
import_export_shared
@shared
=
@project
.
import_export_shared
allow
(
@shared
).
to
receive
(
:export_path
).
and_return
(
'spec/lib/gitlab/import_export/'
)
allow
(
@shared
).
to
receive
(
:export_path
).
and_return
(
'spec/lib/gitlab/import_export/'
)
allow_any_instance_of
(
Repository
).
to
receive
(
:fetch_
ref
).
and_return
(
true
)
allow_any_instance_of
(
Repository
).
to
receive
(
:fetch_
source_branch!
).
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:branch_exists?
).
and_return
(
false
)
allow_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:branch_exists?
).
and_return
(
false
)
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
).
with
(
'feature'
,
'DCBA'
)
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
).
with
(
'feature'
,
'DCBA'
)
...
...
spec/models/repository_spec.rb
View file @
3f0e6d92
...
@@ -1129,16 +1129,12 @@ describe Repository do
...
@@ -1129,16 +1129,12 @@ describe Repository do
end
end
it
'raises Rugged::ReferenceError'
do
it
'raises Rugged::ReferenceError'
do
raise_reference_error
=
raise_error
(
Rugged
::
ReferenceError
)
do
|
err
|
expect
(
err
.
cause
).
to
be_nil
end
expect
do
expect
do
Gitlab
::
Git
::
OperationService
.
new
(
git_user
,
target_project
.
repository
.
raw_repository
)
Gitlab
::
Git
::
OperationService
.
new
(
git_user
,
target_project
.
repository
.
raw_repository
)
.
with_branch
(
'feature'
,
.
with_branch
(
'feature'
,
start_repository:
project
.
repository
.
raw_repository
,
start_repository:
project
.
repository
.
raw_repository
,
&
:itself
)
&
:itself
)
end
.
to
raise_
reference_error
end
.
to
raise_
error
(
Gitlab
::
Git
::
CommandError
)
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