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
3128641f
Commit
3128641f
authored
Nov 15, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Don't execute git hooks if you create branch as part of other change"
This reverts commit
a431ca0f
.
parent
f5bc41b3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
10 deletions
+6
-10
app/models/repository.rb
app/models/repository.rb
+2
-6
app/services/commits/change_service.rb
app/services/commits/change_service.rb
+1
-1
app/services/create_branch_service.rb
app/services/create_branch_service.rb
+2
-2
app/services/files/base_service.rb
app/services/files/base_service.rb
+1
-1
No files found.
app/models/repository.rb
View file @
3128641f
...
...
@@ -162,20 +162,16 @@ class Repository
tags
.
find
{
|
tag
|
tag
.
name
==
name
}
end
def
add_branch
(
user
,
branch_name
,
target
,
with_hooks:
true
)
def
add_branch
(
user
,
branch_name
,
target
)
oldrev
=
Gitlab
::
Git
::
BLANK_SHA
ref
=
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
branch_name
target
=
commit
(
target
).
try
(
:id
)
return
false
unless
target
if
with_hooks
GitHooksService
.
new
.
execute
(
user
,
path_to_repo
,
oldrev
,
target
,
ref
)
do
update_ref!
(
ref
,
target
,
oldrev
)
end
else
update_ref!
(
ref
,
target
,
oldrev
)
end
after_create_branch
find_branch
(
branch_name
)
...
...
app/services/commits/change_service.rb
View file @
3128641f
...
...
@@ -55,7 +55,7 @@ module Commits
return
success
if
repository
.
find_branch
(
new_branch
)
result
=
CreateBranchService
.
new
(
@project
,
current_user
)
.
execute
(
new_branch
,
@target_branch
,
source_project:
@source_project
,
with_hooks:
false
)
.
execute
(
new_branch
,
@target_branch
,
source_project:
@source_project
)
if
result
[
:status
]
==
:error
raise
ChangeError
,
"There was an error creating the source branch:
#{
result
[
:message
]
}
"
...
...
app/services/create_branch_service.rb
View file @
3128641f
require_relative
'base_service'
class
CreateBranchService
<
BaseService
def
execute
(
branch_name
,
ref
,
source_project:
@project
,
with_hooks:
true
)
def
execute
(
branch_name
,
ref
,
source_project:
@project
)
valid_branch
=
Gitlab
::
GitRefValidator
.
validate
(
branch_name
)
unless
valid_branch
...
...
@@ -26,7 +26,7 @@ class CreateBranchService < BaseService
repository
.
find_branch
(
branch_name
)
else
repository
.
add_branch
(
current_user
,
branch_name
,
ref
,
with_hooks:
with_hooks
)
repository
.
add_branch
(
current_user
,
branch_name
,
ref
)
end
if
new_branch
...
...
app/services/files/base_service.rb
View file @
3128641f
...
...
@@ -74,7 +74,7 @@ module Files
end
def
create_target_branch
result
=
CreateBranchService
.
new
(
project
,
current_user
).
execute
(
@target_branch
,
@source_branch
,
source_project:
@source_project
,
with_hooks:
false
)
result
=
CreateBranchService
.
new
(
project
,
current_user
).
execute
(
@target_branch
,
@source_branch
,
source_project:
@source_project
)
unless
result
[
:status
]
==
:success
raise_error
(
"Something went wrong when we tried to create
#{
@target_branch
}
for you:
#{
result
[
:message
]
}
"
)
...
...
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