diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb index 29013be0f97de9679600467e06f38a3b1c3cb677..bd245100955887034435ac0fe1c0a0584eaec9a9 100644 --- a/app/services/files/base_service.rb +++ b/app/services/files/base_service.rb @@ -13,11 +13,5 @@ module Files def repository project.repository end - - 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) - end end end diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb index bafc3565da1c5463c7cd52a987d784b6d841ba64..3516cf30dbc8ee501067245df9574a523bc54fbc 100644 --- a/app/services/files/create_service.rb +++ b/app/services/files/create_service.rb @@ -40,7 +40,7 @@ module Files params[:content] end - sha = repository.commit_file( + created_successfully = repository.commit_file( current_user, file_path, content, @@ -49,8 +49,7 @@ module Files ) - if sha - after_commit(sha) + if created_successfully success else error("Your changes could not be committed, because the file has been changed") diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb index c972f8322bb822133ef131d286087dcfb8462230..4d7ac3b7504786b8c5705ad9d5952012c8a757c2 100644 --- a/app/services/files/update_service.rb +++ b/app/services/files/update_service.rb @@ -26,7 +26,7 @@ module Files params[:content] end - sha = repository.commit_file( + repository.commit_file( current_user, path, content, @@ -34,7 +34,6 @@ module Files params[:new_branch] || ref ) - after_commit(sha) success rescue Gitlab::Satellite::CheckoutFailed => ex error("Your changes could not be committed because ref '#{ref}' could not be checked out", 400)