summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-02 12:06:40 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-02 12:06:40 +0200
commit435f680b897b892103fa157d4699dbb6d9ecf758 (patch)
tree09d15697ae9f29b9a127b4d4d835b036244bf346
parent8997812626b85ff0838ec60047d17e0c5f2a5aca (diff)
downloadgitlab-ce-435f680b897b892103fa157d4699dbb6d9ecf758.tar.gz
Make web editor work correctly after switch from satellites
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/services/files/base_service.rb3
-rw-r--r--app/services/files/create_service.rb2
-rw-r--r--app/services/files/delete_service.rb2
-rw-r--r--app/services/files/update_service.rb2
-rw-r--r--app/services/git_push_service.rb3
5 files changed, 7 insertions, 5 deletions
diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb
index 29013be0f97..4d02752454e 100644
--- a/app/services/files/base_service.rb
+++ b/app/services/files/base_service.rb
@@ -17,7 +17,8 @@ module Files
def after_commit(sha)
commit = repository.commit(sha)
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
diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb
index bafc3565da1..0a80455bc6b 100644
--- a/app/services/files/create_service.rb
+++ b/app/services/files/create_service.rb
@@ -1,7 +1,7 @@
require_relative "base_service"
module Files
- class CreateService < BaseService
+ class CreateService < Files::BaseService
def execute
allowed = Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref)
diff --git a/app/services/files/delete_service.rb b/app/services/files/delete_service.rb
index fabcdc19648..2281777604c 100644
--- a/app/services/files/delete_service.rb
+++ b/app/services/files/delete_service.rb
@@ -1,7 +1,7 @@
require_relative "base_service"
module Files
- class DeleteService < BaseService
+ class DeleteService < Files::BaseService
def execute
allowed = ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref)
diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb
index c972f8322bb..013cc1ee322 100644
--- a/app/services/files/update_service.rb
+++ b/app/services/files/update_service.rb
@@ -1,7 +1,7 @@
require_relative "base_service"
module Files
- class UpdateService < BaseService
+ class UpdateService < Files::BaseService
def execute
allowed = ::Gitlab::GitAccess.new(current_user, project).can_push_to_branch?(ref)
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb
index bdf36af02fd..cde65349d5c 100644
--- a/app/services/git_push_service.rb
+++ b/app/services/git_push_service.rb
@@ -127,7 +127,8 @@ class GitPushService
end
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
def commit_user(commit)