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
iv
gitlab-ce
Commits
835cbc06
Commit
835cbc06
authored
Dec 02, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reload mr code on force push too
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
9211b541
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
9 deletions
+22
-9
app/services/merge_requests/refresh_service.rb
app/services/merge_requests/refresh_service.rb
+6
-1
lib/gitlab/force_push_check.rb
lib/gitlab/force_push_check.rb
+15
-0
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+1
-8
No files found.
app/services/merge_requests/refresh_service.rb
View file @
835cbc06
...
...
@@ -3,6 +3,7 @@ module MergeRequests
def
execute
(
oldrev
,
newrev
,
ref
)
return
true
unless
ref
=~
/heads/
@oldrev
,
@newrev
=
oldrev
,
newrev
@branch_name
=
ref
.
gsub
(
"refs/heads/"
,
""
)
@fork_merge_requests
=
@project
.
fork_merge_requests
.
opened
@commits
=
@project
.
repository
.
commits_between
(
oldrev
,
newrev
)
...
...
@@ -35,6 +36,10 @@ module MergeRequests
end
end
def
force_push?
Gitlab
::
ForcePushCheck
.
force_push?
(
@project
,
@oldrev
,
@newrev
)
end
# Refresh merge request diff if we push to source or target branch of merge request
# Note: we should update merge requests from forks too
def
reload_merge_requests
...
...
@@ -44,7 +49,7 @@ module MergeRequests
merge_requests
.
each
do
|
merge_request
|
if
merge_request
.
source_branch
==
@branch_name
if
merge_request
.
source_branch
==
@branch_name
||
force_push?
merge_request
.
reload_code
merge_request
.
mark_as_unchecked
else
...
...
lib/gitlab/force_push_check.rb
0 → 100644
View file @
835cbc06
module
Gitlab
class
ForcePushCheck
def
self
.
force_push?
(
project
,
oldrev
,
newrev
)
return
false
if
project
.
empty_repo?
if
oldrev
!=
Gitlab
::
Git
::
BLANK_SHA
&&
newrev
!=
Gitlab
::
Git
::
BLANK_SHA
missed_refs
=
IO
.
popen
(
%W(git --git-dir=
#{
project
.
repository
.
path_to_repo
}
rev-list
#{
oldrev
}
^
#{
newrev
}
)
).
read
missed_refs
.
split
(
"
\n
"
).
size
>
0
else
false
end
end
end
end
lib/gitlab/git_access.rb
View file @
835cbc06
...
...
@@ -94,14 +94,7 @@ module Gitlab
end
def
forced_push?
(
project
,
oldrev
,
newrev
)
return
false
if
project
.
empty_repo?
if
oldrev
!=
Gitlab
::
Git
::
BLANK_SHA
&&
newrev
!=
Gitlab
::
Git
::
BLANK_SHA
missed_refs
=
IO
.
popen
(
%W(git --git-dir=
#{
project
.
repository
.
path_to_repo
}
rev-list
#{
oldrev
}
^
#{
newrev
}
)
).
read
missed_refs
.
split
(
"
\n
"
).
size
>
0
else
false
end
Gitlab
::
ForcePushCheck
.
force_push?
(
project
,
oldrev
,
newrev
)
end
private
...
...
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