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
a5a5ec97
Commit
a5a5ec97
authored
Mar 19, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fewer constants, more helpers.
parent
7ed6da54
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
app/services/git_push_service.rb
app/services/git_push_service.rb
+1
-1
app/workers/irker_worker.rb
app/workers/irker_worker.rb
+3
-3
lib/gitlab/force_push_check.rb
lib/gitlab/force_push_check.rb
+4
-3
lib/gitlab/push_data_builder.rb
lib/gitlab/push_data_builder.rb
+2
-1
No files found.
app/services/git_push_service.rb
View file @
a5a5ec97
...
...
@@ -109,7 +109,7 @@ class GitPushService
def
push_to_existing_branch?
(
ref
,
oldrev
)
# Return if this is not a push to a branch (e.g. new commits)
Gitlab
::
Git
.
branch_ref?
(
ref
)
&&
oldrev
!=
Gitlab
::
Git
::
BLANK_SHA
Gitlab
::
Git
.
branch_ref?
(
ref
)
&&
!
Gitlab
::
Git
.
blank_ref?
(
oldrev
)
end
def
push_to_new_branch?
(
ref
,
oldrev
)
...
...
app/workers/irker_worker.rb
View file @
a5a5ec97
...
...
@@ -57,9 +57,9 @@ class IrkerWorker
end
def
send_branch_updates
(
push_data
,
project
,
repo_name
,
committer
,
branch
)
if
push_data
[
'before'
]
==
Gitlab
::
Git
::
BLANK_SHA
if
Gitlab
::
Git
.
blank_ref?
(
push_data
[
'before'
])
send_new_branch
project
,
repo_name
,
committer
,
branch
elsif
push_data
[
'after'
]
==
Gitlab
::
Git
::
BLANK_SHA
elsif
Gitlab
::
Git
.
blank_ref?
(
push_data
[
'after'
])
send_del_branch
repo_name
,
committer
,
branch
end
end
...
...
@@ -83,7 +83,7 @@ class IrkerWorker
return
if
push_data
[
'total_commits_count'
]
==
0
# Next message is for number of commit pushed, if any
if
push_data
[
'before'
]
==
Gitlab
::
Git
::
BLANK_SHA
if
Gitlab
::
Git
.
blank_ref?
(
push_data
[
'before'
])
# Tweak on push_data["before"] in order to have a nice compare URL
push_data
[
'before'
]
=
before_on_new_branch
push_data
,
project
end
...
...
lib/gitlab/force_push_check.rb
View file @
a5a5ec97
...
...
@@ -3,11 +3,12 @@ module Gitlab
def
self
.
force_push?
(
project
,
oldrev
,
newrev
)
return
false
if
project
.
empty_repo?
if
oldrev
!=
Gitlab
::
Git
::
BLANK_SHA
&&
newrev
!=
Gitlab
::
Git
::
BLANK_SHA
# Created or deleted branch
if
Gitlab
::
Git
.
blank_ref?
(
oldrev
)
||
Gitlab
::
Git
.
blank_ref?
(
newrev
)
false
else
missed_refs
,
_
=
Gitlab
::
Popen
.
popen
(
%W(git --git-dir=
#{
project
.
repository
.
path_to_repo
}
rev-list
#{
oldrev
}
^
#{
newrev
}
)
)
missed_refs
.
split
(
"
\n
"
).
size
>
0
else
false
end
end
end
...
...
lib/gitlab/push_data_builder.rb
View file @
a5a5ec97
...
...
@@ -71,7 +71,8 @@ module Gitlab
end
def
checkout_sha
(
repository
,
newrev
,
ref
)
if
newrev
!=
Gitlab
::
Git
::
BLANK_SHA
&&
Gitlab
::
Git
.
tag_ref?
(
ref
)
# Find sha for tag, except when it was deleted.
if
Gitlab
::
Git
.
tag_ref?
(
ref
)
&&
!
Gitlab
::
Git
.
blank_ref?
(
newrev
)
tag_name
=
Gitlab
::
Git
.
ref_name
(
ref
)
tag
=
repository
.
find_tag
(
tag_name
)
...
...
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