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
5105469a
Commit
5105469a
authored
Jun 25, 2018
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move git calls for `Repository#update_branch` inside Gitlab::Git
This prepares this code for migration to Gitaly.
parent
cb30eaf4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
+9
-10
ee/app/models/ee/repository.rb
ee/app/models/ee/repository.rb
+0
-7
ee/app/services/projects/update_mirror_service.rb
ee/app/services/projects/update_mirror_service.rb
+4
-1
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+5
-2
No files found.
ee/app/models/ee/repository.rb
View file @
5105469a
...
...
@@ -35,12 +35,5 @@ module EE
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1243
::
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
{
super
}
end
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1246
def
update_branch
(
user
,
branch_name
,
newrev
,
oldrev
)
::
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
::
Gitlab
::
Git
::
OperationService
.
new
(
user
,
raw_repository
).
update_branch
(
branch_name
,
newrev
,
oldrev
)
end
end
end
end
ee/app/services/projects/update_mirror_service.rb
View file @
5105469a
...
...
@@ -97,7 +97,10 @@ module Projects
newrev
=
upstream
.
dereferenced_target
.
sha
oldrev
=
local
.
dereferenced_target
.
sha
repository
.
update_branch
(
current_user
,
branch_name
,
newrev
,
oldrev
)
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/1246
::
Gitlab
::
GitalyClient
::
StorageSettings
.
allow_disk_access
do
repository
.
update_branch
(
branch_name
,
user:
current_user
,
newrev:
newrev
,
oldrev:
oldrev
)
end
elsif
branch_name
==
project
.
default_branch
# Cannot be updated
errors
<<
"The default branch (
#{
project
.
default_branch
}
) has diverged from its upstream counterpart and could not be updated automatically."
...
...
lib/gitlab/git/repository.rb
View file @
5105469a
...
...
@@ -699,6 +699,10 @@ module Gitlab
end
end
def
update_branch
(
branch_name
,
user
:,
newrev
:,
oldrev
:)
OperationService
.
new
(
user
,
self
).
update_branch
(
branch_name
,
newrev
,
oldrev
)
end
def
rm_branch
(
branch_name
,
user
:)
gitaly_migrate
(
:operation_user_delete_branch
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
is_enabled
|
if
is_enabled
...
...
@@ -2004,8 +2008,7 @@ module Gitlab
rebase_sha
=
run_git!
(
%w(rev-parse HEAD)
,
chdir:
rebase_path
,
env:
env
).
strip
Gitlab
::
Git
::
OperationService
.
new
(
user
,
self
)
.
update_branch
(
branch
,
rebase_sha
,
branch_sha
)
update_branch
(
branch
,
user:
user
,
newrev:
rebase_sha
,
oldrev:
branch_sha
)
rebase_sha
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