Make web editor work correctly after switch from satellites

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2015-06-02 12:06:40 +02:00
parent 8997812626
commit 435f680b89
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
5 changed files with 7 additions and 5 deletions

View file

@ -17,7 +17,8 @@ module Files
def after_commit(sha) def after_commit(sha)
commit = repository.commit(sha) commit = repository.commit(sha)
full_ref = 'refs/heads/' + (params[:new_branch] || ref) full_ref = 'refs/heads/' + (params[:new_branch] || ref)
GitPushService.new.execute(project, current_user, commit.parent_id, sha, full_ref) old_sha = commit.parent_id || Gitlab::Git::BLANK_SHA
GitPushService.new.execute(project, current_user, old_sha, sha, full_ref)
end end
end end
end end

View file

@ -1,7 +1,7 @@
require_relative "base_service" require_relative "base_service"
module Files module Files
class CreateService < BaseService class CreateService < Files::BaseService
def execute def execute
allowed = Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref) allowed = Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref)

View file

@ -1,7 +1,7 @@
require_relative "base_service" require_relative "base_service"
module Files module Files
class DeleteService < BaseService class DeleteService < Files::BaseService
def execute def execute
allowed = ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref) allowed = ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref)

View file

@ -1,7 +1,7 @@
require_relative "base_service" require_relative "base_service"
module Files module Files
class UpdateService < BaseService class UpdateService < Files::BaseService
def execute def execute
allowed = ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref) allowed = ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref)

View file

@ -127,7 +127,8 @@ class GitPushService
end end
def is_default_branch?(ref) def is_default_branch?(ref)
Gitlab::Git.branch_ref?(ref) && Gitlab::Git.ref_name(ref) == project.default_branch Gitlab::Git.branch_ref?(ref) &&
(Gitlab::Git.ref_name(ref) == project.default_branch || project.default_branch.nil?)
end end
def commit_user(commit) def commit_user(commit)