From 6fbdc5ed5224154b89cf351e11a8f9db48e6d7f0 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Wed, 24 Oct 2018 18:01:44 +0200 Subject: Apply patches when creating MR via email This allows users to add patches as attachments to merge request created via email. When an email to create a merge request is sent, all the attachments ending in `.patch` will be applied to the branch specified in the subject of the email. If the branch did not exist, it will be created from the HEAD of the repository. When the patches could not be applied, the error message will be replied to the user. The patches can have a maximum combined size of 2MB for now. --- app/services/commits/create_service.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/services/commits/create_service.rb') diff --git a/app/services/commits/create_service.rb b/app/services/commits/create_service.rb index 3ce9acc833c..34593e12bd5 100644 --- a/app/services/commits/create_service.rb +++ b/app/services/commits/create_service.rb @@ -19,7 +19,12 @@ module Commits new_commit = create_commit! success(result: new_commit) - rescue ValidationError, ChangeError, Gitlab::Git::Index::IndexError, Gitlab::Git::CommitError, Gitlab::Git::PreReceiveError => ex + rescue ValidationError, + ChangeError, + Gitlab::Git::Index::IndexError, + Gitlab::Git::CommitError, + Gitlab::Git::PreReceiveError, + Gitlab::Git::CommandError => ex error(ex.message) end -- cgit v1.2.3