Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean Edge <asedge@gmail.com>2014-06-24 05:35:36 +0400
committerSean Edge <asedge@gmail.com>2014-09-04 17:47:20 +0400
commit468b2e8e0b46e7a7cee7cc9d9ce9b5c22e79c467 (patch)
treec19de65b8133c26a38a9813b9c6c5be412842e75 /app
parent487f78be129d44ae3dc098c9bd17925975435097 (diff)
Added annotated tags. Updated tag haml file and call to gitlab-shell. Updated API for annotated tags. Added tests for API. Strip leading/trailing whitespace from message, if present. Update CHANGELOG.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/tags_controller.rb3
-rw-r--r--app/models/repository.rb4
-rw-r--r--app/services/create_tag_service.rb8
-rw-r--r--app/views/projects/tags/new.html.haml5
4 files changed, 15 insertions, 5 deletions
diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb
index b84c497131a..86788b9963b 100644
--- a/app/controllers/projects/tags_controller.rb
+++ b/app/controllers/projects/tags_controller.rb
@@ -14,7 +14,8 @@ class Projects::TagsController < Projects::ApplicationController
def create
result = CreateTagService.new.execute(@project, params[:tag_name],
- params[:ref], current_user)
+ params[:ref], params[:message],
+ current_user)
if result[:status] == :success
@tag = result[:tag]
redirect_to project_tags_path(@project)
diff --git a/app/models/repository.rb b/app/models/repository.rb
index e970c449a73..9dd8603621f 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -64,10 +64,10 @@ class Repository
gitlab_shell.add_branch(path_with_namespace, branch_name, ref)
end
- def add_tag(tag_name, ref)
+ def add_tag(tag_name, ref, message = nil)
Rails.cache.delete(cache_key(:tag_names))
- gitlab_shell.add_tag(path_with_namespace, tag_name, ref)
+ gitlab_shell.add_tag(path_with_namespace, tag_name, ref, message)
end
def rm_branch(branch_name)
diff --git a/app/services/create_tag_service.rb b/app/services/create_tag_service.rb
index 6869acbe467..3716abd4b2b 100644
--- a/app/services/create_tag_service.rb
+++ b/app/services/create_tag_service.rb
@@ -1,5 +1,5 @@
class CreateTagService
- def execute(project, tag_name, ref, current_user)
+ def execute(project, tag_name, ref, message, current_user)
valid_tag = Gitlab::GitRefValidator.validate(tag_name)
if valid_tag == false
return error('Tag name invalid')
@@ -11,7 +11,11 @@ class CreateTagService
return error('Tag already exists')
end
- repository.add_tag(tag_name, ref)
+ if message
+ message.gsub!(/^\s+|\s+$/, '')
+ end
+
+ repository.add_tag(tag_name, ref, message)
new_tag = repository.find_tag(tag_name)
if new_tag
diff --git a/app/views/projects/tags/new.html.haml b/app/views/projects/tags/new.html.haml
index f3a34d37df5..45ee61caf68 100644
--- a/app/views/projects/tags/new.html.haml
+++ b/app/views/projects/tags/new.html.haml
@@ -15,6 +15,11 @@
.col-sm-10
= text_field_tag :ref, params[:ref], placeholder: 'master', required: true, tabindex: 2, class: 'form-control'
.light Branch name or commit SHA
+ .form-group
+ = label_tag :message, 'Message', class: 'control-label'
+ .col-sm-10
+ = text_field_tag :message, nil, placeholder: 'Enter message.', required: false, tabindex: 3, class: 'form-control'
+ .light (Optional) Entering a message will create an annotated tag.
.form-actions
= submit_tag 'Create tag', class: 'btn btn-create', tabindex: 3
= link_to 'Cancel', project_tags_path(@project), class: 'btn btn-cancel'