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
bacad39e
Commit
bacad39e
authored
Aug 14, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure target has not changed during pre-receive hook
parent
9649f938
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
app/services/commit_service.rb
app/services/commit_service.rb
+8
-1
No files found.
app/services/commit_service.rb
View file @
bacad39e
...
...
@@ -34,7 +34,14 @@ class CommitService
repository
.
rugged
.
references
.
create
(
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
ref
,
sha
)
else
# Update head
repository
.
rugged
.
references
.
update
(
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
ref
,
sha
)
current_target
=
repository
.
find_branch
(
ref
).
target
# Make sure target branch was not changed during pre-receive hook
if
current_target
==
target
repository
.
rugged
.
references
.
update
(
Gitlab
::
Git
::
BRANCH_REF_PREFIX
+
ref
,
sha
)
else
raise
CommitError
.
new
(
'Commit was rejected because branch received new push'
)
end
end
# Run GitLab post receive hook
...
...
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