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
Boxiang Sun
gitlab-ce
Commits
a1a91499
Commit
a1a91499
authored
Aug 24, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid committer = lines
parent
961da7d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
21 deletions
+11
-21
app/models/repository.rb
app/models/repository.rb
+9
-18
app/services/git_operation_service.rb
app/services/git_operation_service.rb
+2
-3
No files found.
app/models/repository.rb
View file @
a1a91499
...
@@ -164,8 +164,7 @@ class Repository
...
@@ -164,8 +164,7 @@ class Repository
return
false
unless
newrev
return
false
unless
newrev
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
user
)
GitOperationService
.
new
(
user
,
self
).
add_branch
(
branch_name
,
newrev
)
GitOperationService
.
new
(
committer
,
self
).
add_branch
(
branch_name
,
newrev
)
after_create_branch
after_create_branch
find_branch
(
branch_name
)
find_branch
(
branch_name
)
...
@@ -177,8 +176,7 @@ class Repository
...
@@ -177,8 +176,7 @@ class Repository
return
false
unless
newrev
return
false
unless
newrev
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
user
)
GitOperationService
.
new
(
user
,
self
).
add_tag
(
tag_name
,
newrev
,
options
)
GitOperationService
.
new
(
committer
,
self
).
add_tag
(
tag_name
,
newrev
,
options
)
find_tag
(
tag_name
)
find_tag
(
tag_name
)
end
end
...
@@ -187,8 +185,7 @@ class Repository
...
@@ -187,8 +185,7 @@ class Repository
before_remove_branch
before_remove_branch
branch
=
find_branch
(
branch_name
)
branch
=
find_branch
(
branch_name
)
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
user
)
GitOperationService
.
new
(
user
,
self
).
rm_branch
(
branch
)
GitOperationService
.
new
(
committer
,
self
).
rm_branch
(
branch
)
after_remove_branch
after_remove_branch
true
true
...
@@ -198,8 +195,7 @@ class Repository
...
@@ -198,8 +195,7 @@ class Repository
before_remove_tag
before_remove_tag
tag
=
find_tag
(
tag_name
)
tag
=
find_tag
(
tag_name
)
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
user
)
GitOperationService
.
new
(
user
,
self
).
rm_tag
(
tag
)
GitOperationService
.
new
(
committer
,
self
).
rm_tag
(
tag
)
after_remove_tag
after_remove_tag
true
true
...
@@ -767,8 +763,7 @@ class Repository
...
@@ -767,8 +763,7 @@ class Repository
author_email:
nil
,
author_name:
nil
,
author_email:
nil
,
author_name:
nil
,
start_branch_name:
nil
,
start_project:
project
)
start_branch_name:
nil
,
start_project:
project
)
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
user
)
GitOperationService
.
new
(
user
,
self
).
with_branch
(
GitOperationService
.
new
(
committer
,
self
).
with_branch
(
branch_name
,
branch_name
,
start_branch_name:
start_branch_name
,
start_branch_name:
start_branch_name
,
start_project:
start_project
)
do
|
start_commit
|
start_project:
start_project
)
do
|
start_commit
|
...
@@ -824,8 +819,7 @@ class Repository
...
@@ -824,8 +819,7 @@ class Repository
end
end
def
merge
(
user
,
source
,
merge_request
,
options
=
{})
def
merge
(
user
,
source
,
merge_request
,
options
=
{})
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
user
)
GitOperationService
.
new
(
user
,
self
).
with_branch
(
GitOperationService
.
new
(
committer
,
self
).
with_branch
(
merge_request
.
target_branch
)
do
|
start_commit
|
merge_request
.
target_branch
)
do
|
start_commit
|
our_commit
=
start_commit
.
sha
our_commit
=
start_commit
.
sha
their_commit
=
source
their_commit
=
source
...
@@ -852,8 +846,7 @@ class Repository
...
@@ -852,8 +846,7 @@ class Repository
def
revert
(
def
revert
(
user
,
commit
,
branch_name
,
user
,
commit
,
branch_name
,
start_branch_name:
nil
,
start_project:
project
)
start_branch_name:
nil
,
start_project:
project
)
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
user
)
GitOperationService
.
new
(
user
,
self
).
with_branch
(
GitOperationService
.
new
(
committer
,
self
).
with_branch
(
branch_name
,
branch_name
,
start_branch_name:
start_branch_name
,
start_branch_name:
start_branch_name
,
start_project:
start_project
)
do
|
start_commit
|
start_project:
start_project
)
do
|
start_commit
|
...
@@ -876,8 +869,7 @@ class Repository
...
@@ -876,8 +869,7 @@ class Repository
def
cherry_pick
(
def
cherry_pick
(
user
,
commit
,
branch_name
,
user
,
commit
,
branch_name
,
start_branch_name:
nil
,
start_project:
project
)
start_branch_name:
nil
,
start_project:
project
)
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
user
)
GitOperationService
.
new
(
user
,
self
).
with_branch
(
GitOperationService
.
new
(
committer
,
self
).
with_branch
(
branch_name
,
branch_name
,
start_branch_name:
start_branch_name
,
start_branch_name:
start_branch_name
,
start_project:
start_project
)
do
|
start_commit
|
start_project:
start_project
)
do
|
start_commit
|
...
@@ -902,8 +894,7 @@ class Repository
...
@@ -902,8 +894,7 @@ class Repository
end
end
def
resolve_conflicts
(
user
,
branch_name
,
params
)
def
resolve_conflicts
(
user
,
branch_name
,
params
)
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
user
)
GitOperationService
.
new
(
user
,
self
).
with_branch
(
branch_name
)
do
GitOperationService
.
new
(
committer
,
self
).
with_branch
(
branch_name
)
do
committer
=
user_to_committer
(
user
)
committer
=
user_to_committer
(
user
)
create_commit
(
params
.
merge
(
author:
committer
,
committer:
committer
))
create_commit
(
params
.
merge
(
author:
committer
,
committer:
committer
))
...
...
app/services/git_operation_service.rb
View file @
a1a91499
...
@@ -2,10 +2,9 @@ class GitOperationService
...
@@ -2,10 +2,9 @@ class GitOperationService
attr_reader
:committer
,
:repository
attr_reader
:committer
,
:repository
def
initialize
(
committer
,
new_repository
)
def
initialize
(
committer
,
new_repository
)
if
committer
&&
!
committer
.
is_a?
(
Gitlab
::
Git
::
Committer
)
committer
=
Gitlab
::
Git
::
Committer
.
from_user
(
committer
)
if
committer
.
is_a?
(
User
)
raise
"expected Gitlab::Git::Committer, got
#{
committer
.
inspect
}
"
end
@committer
=
committer
@committer
=
committer
@repository
=
new_repository
@repository
=
new_repository
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