diff options
Diffstat (limited to 'app/services/git_push_service.rb')
-rw-r--r-- | app/services/git_push_service.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index d7ea30bc315..e3bf14966c8 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -18,18 +18,23 @@ class GitPushService def execute(project, user, oldrev, newrev, ref) @project, @user = project, user - project.repository.expire_cache + branch_name = Gitlab::Git.ref_name(ref) + + project.repository.expire_cache(branch_name) if push_remove_branch?(ref, newrev) + project.repository.expire_has_visible_content_cache + @push_commits = [] elsif push_to_new_branch?(ref, oldrev) + project.repository.expire_has_visible_content_cache + # Re-find the pushed commits. if is_default_branch?(ref) # Initial push to the default branch. Take the full history of that branch as "newly pushed". @push_commits = project.repository.commits(newrev) # Ensure HEAD points to the default branch in case it is not master - branch_name = Gitlab::Git.ref_name(ref) project.change_head(branch_name) # Set protection on the default branch if configured |