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
c921e686
Commit
c921e686
authored
Apr 23, 2018
by
Francisco Javier López
Committed by
Douwe Maan
Apr 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved committer and spec. Added some extra code to run hooks or not depending on the options
parent
1edd5c73
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
lib/gitlab/git/committer_with_hooks.rb
lib/gitlab/git/committer_with_hooks.rb
+9
-1
lib/gitlab/git/wiki.rb
lib/gitlab/git/wiki.rb
+1
-1
spec/lib/gitlab/git/committer_with_hooks_spec.rb
spec/lib/gitlab/git/committer_with_hooks_spec.rb
+1
-1
No files found.
lib/gitlab/
wiki
/committer_with_hooks.rb
→
lib/gitlab/
git
/committer_with_hooks.rb
View file @
c921e686
module
Gitlab
module
Wiki
module
Git
class
CommitterWithHooks
<
Gollum
::
Committer
attr_reader
:gl_wiki
...
...
@@ -9,6 +9,9 @@ module Gitlab
end
def
commit
# TODO: Remove after 10.8
return
super
unless
allowed_to_run_hooks?
result
=
Gitlab
::
Git
::
OperationService
.
new
(
git_user
,
gl_wiki
.
repository
).
with_branch
(
@wiki
.
ref
,
start_branch_name:
@wiki
.
ref
...
...
@@ -24,6 +27,11 @@ module Gitlab
private
# TODO: Remove after 10.8
def
allowed_to_run_hooks?
@options
[
:user_id
]
!=
0
&&
@options
[
:username
].
present?
end
def
git_user
@git_user
||=
Gitlab
::
Git
::
User
.
new
(
@options
[
:username
],
@options
[
:name
],
...
...
lib/gitlab/git/wiki.rb
View file @
c921e686
...
...
@@ -290,7 +290,7 @@ module Gitlab
end
def
committer_with_hooks
(
commit_details
)
Gitlab
::
Wiki
::
CommitterWithHooks
.
new
(
self
,
commit_details
.
to_h
)
Gitlab
::
Git
::
CommitterWithHooks
.
new
(
self
,
commit_details
.
to_h
)
end
def
with_committer_with_hooks
(
commit_details
,
&
block
)
...
...
spec/lib/gitlab/
wiki
/committer_with_hooks_spec.rb
→
spec/lib/gitlab/
git
/committer_with_hooks_spec.rb
View file @
c921e686
require
'spec_helper'
describe
Gitlab
::
Wiki
::
CommitterWithHooks
,
seed_helper:
true
do
describe
Gitlab
::
Git
::
CommitterWithHooks
,
seed_helper:
true
do
shared_examples
'calling wiki hooks'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
project
.
owner
}
...
...
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