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
Léo-Paul Géneau
gitlab-ce
Commits
876c6f24
Commit
876c6f24
authored
Nov 04, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:gitlabhq/gitlabhq
parents
5cab9d6f
11357c8b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
lib/gitlab/git.rb
lib/gitlab/git.rb
+5
-0
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+2
-2
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+4
-3
No files found.
lib/gitlab/git.rb
0 → 100644
View file @
876c6f24
module
Gitlab
module
Git
BLANK_SHA
=
'0'
*
40
end
end
lib/gitlab/git_access.rb
View file @
876c6f24
...
...
@@ -67,7 +67,7 @@ module Gitlab
if
forced_push?
(
project
,
oldrev
,
newrev
)
:force_push_code_to_protected_branches
# and we dont allow remove of protected branch
elsif
newrev
=
~
/0000000/
elsif
newrev
=
=
Gitlab
::
Git
::
BLANK_SHA
:remove_protected_branches
else
:push_code_to_protected_branches
...
...
@@ -85,7 +85,7 @@ module Gitlab
def
forced_push?
(
project
,
oldrev
,
newrev
)
return
false
if
project
.
empty_repo?
if
oldrev
!
~
/00000000/
&&
newrev
!~
/00000000/
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
...
...
spec/lib/gitlab/git_access_spec.rb
View file @
876c6f24
...
...
@@ -55,12 +55,13 @@ describe Gitlab::GitAccess do
def
changes
{
push_new_branch:
'000000000 570e7b2ab refs/heads/wow'
,
push_new_branch:
"
#{
Gitlab
::
Git
::
BLANK_SHA
}
570e7b2ab refs/heads/wow"
,
push_master:
'6f6d7e7ed 570e7b2ab refs/heads/master'
,
push_protected_branch:
'6f6d7e7ed 570e7b2ab refs/heads/feature'
,
push_remove_protected_branch:
'570e7b2ab 000000000 refs/heads/feature'
,
push_remove_protected_branch:
"570e7b2ab
#{
Gitlab
::
Git
::
BLANK_SHA
}
"
\
'refs/heads/feature'
,
push_tag:
'6f6d7e7ed 570e7b2ab refs/tags/v1.0.0'
,
push_new_tag:
'000000000 570e7b2ab refs/tags/v7.8.9'
,
push_new_tag:
"
#{
Gitlab
::
Git
::
BLANK_SHA
}
570e7b2ab refs/tags/v7.8.9"
,
push_all:
[
'6f6d7e7ed 570e7b2ab refs/heads/master'
,
'6f6d7e7ed 570e7b2ab refs/heads/feature'
]
}
end
...
...
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