Открыть боковую панель
nt_test121
nt_project_9da4a5yt9x4b
Коммиты
95c59b2e
Коммит
95c59b2e
создал
Июн 20, 2016
по автору
Paco Guzman
Просмотр файлов
Trying to reduce git calls
владелец
98cede7e
Изменения
5
Скрыть пробелы
Построчно
Рядом
app/controllers/projects/application_controller.rb
Просмотр файла @
95c59b2e
...
...
@@ -74,7 +74,7 @@ def require_non_empty_project
end
def
require_branch_head
unless
@repository
.
branch_
names
.
include
?
(
@ref
)
unless
@repository
.
branch_
exists
?
(
@ref
)
redirect_to
(
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@ref
),
notice:
"This action is not allowed unless you are on a branch"
...
...
app/helpers/application_helper.rb
Просмотр файла @
95c59b2e
...
...
@@ -132,7 +132,7 @@ def show_last_push_widget?(event)
return
false
if
project
.
merge_requests
.
where
(
source_branch:
event
.
branch_name
).
opened
.
any?
# Skip if user removed branch right after that
return
false
unless
project
.
repository
.
branch_
names
.
include
?
(
event
.
branch_name
)
return
false
unless
project
.
repository
.
branch_
exists
?
(
event
.
branch_name
)
true
end
...
...
app/helpers/branches_helper.rb
Просмотр файла @
95c59b2e
...
...
@@ -10,7 +10,7 @@ def can_remove_branch?(project, branch_name)
end
def
can_push_branch?
(
project
,
branch_name
)
return
false
unless
project
.
repository
.
branch_
names
.
include
?
(
branch_name
)
return
false
unless
project
.
repository
.
branch_
exists
?
(
branch_name
)
::
Gitlab
::
GitAccess
.
new
(
current_user
,
project
).
can_push_to_branch?
(
branch_name
)
end
...
...
app/models/repository.rb
Просмотр файла @
95c59b2e
...
...
@@ -192,7 +192,7 @@ def rm_tag(tag_name)
end
def
branch_names
cache
.
fetch
(
:branch_names
)
{
branches
.
map
(
&
:name
)
}
@branch_names
||=
cache
.
fetch
(
:branch_names
)
{
branches
.
map
(
&
:name
)
}
end
def
branch_exists?
(
branch_name
)
...
...
@@ -267,6 +267,7 @@ def expire_tags_cache
def
expire_branches_cache
cache
.
expire
(
:branch_names
)
@branch_names
=
nil
@local_branches
=
nil
end
...
...
@@ -332,10 +333,6 @@ def lookup_cache
@lookup_cache
||=
{}
end
def
expire_branch_names
cache
.
expire
(
:branch_names
)
end
def
expire_avatar_cache
(
branch_name
=
nil
,
revision
=
nil
)
# Avatars are pulled from the default branch, thus if somebody pushes to a
# different branch there's no need to expire anything.
...
...
@@ -430,20 +427,7 @@ def after_remove_branch
expire_branch_count_cache
expire_branches_cache
end
def
method_missing
(
m
,
*
args
,
&
block
)
if
m
==
:lookup
&&
!
block_given?
lookup_cache
[
m
]
||=
{}
lookup_cache
[
m
][
args
.
join
(
":"
)]
||=
raw_repository
.
send
(
m
,
*
args
,
&
block
)
else
raw_repository
.
send
(
m
,
*
args
,
&
block
)
end
end
def
respond_to_missing?
(
method
,
include_private
=
false
)
raw_repository
.
respond_to?
(
method
,
include_private
)
||
super
end
def
blob_at
(
sha
,
path
)
unless
Gitlab
::
Git
.
blank_ref?
(
sha
)
Blob
.
decorate
(
Gitlab
::
Git
::
Blob
.
find
(
self
,
sha
,
path
))
...
...
spec/workers/merge_worker_spec.rb
Просмотр файла @
95c59b2e
...
...
@@ -9,7 +9,7 @@
before
do
source_project
.
team
<<
[
author
,
:master
]
source_project
.
repository
.
expire_branch
_names
source_project
.
repository
.
expire_branch
es_cache
end
it
'clears cache of source repo after removing source branch'
do
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать