summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-04-09 16:08:10 +0000
committerRobert Speicher <robert@gitlab.com>2018-04-09 16:08:10 +0000
commit91a3a4b526214f4174f4f12de23dfb5baf033211 (patch)
treedc3a600fe208621d7cb9cf71a1f1f2246f93bea1
parentdb204e23fc5a1bf161e7475fe06199fb435e1cab (diff)
parent3a4086e22f2a4c837635f14bb6e9ae056299dc6c (diff)
downloadgitlab-ce-91a3a4b526214f4174f4f12de23dfb5baf033211.tar.gz
Merge branch 'feature/add_target_to_tags' into 'master'
Expose the target commit ID through the tag API See merge request gitlab-org/gitlab-ce!18248
-rw-r--r--changelogs/unreleased/feature-add_target_to_tags.yml5
-rw-r--r--doc/api/tags.md6
-rw-r--r--lib/api/entities.rb2
-rw-r--r--spec/fixtures/api/schemas/public_api/v4/tag.json1
4 files changed, 13 insertions, 1 deletions
diff --git a/changelogs/unreleased/feature-add_target_to_tags.yml b/changelogs/unreleased/feature-add_target_to_tags.yml
new file mode 100644
index 00000000000..75816005e1f
--- /dev/null
+++ b/changelogs/unreleased/feature-add_target_to_tags.yml
@@ -0,0 +1,5 @@
+---
+title: Expose the target commit ID through the tag API
+merge_request:
+author:
+type: added
diff --git a/doc/api/tags.md b/doc/api/tags.md
index fa25dc76452..4af096c3c0c 100644
--- a/doc/api/tags.md
+++ b/doc/api/tags.md
@@ -42,6 +42,7 @@ Parameters:
"description": "Amazing release. Wow"
},
"name": "v1.0.0",
+ "target": "2695effb5807a22ff3d138d593fd856244e155e7",
"message": null
}
]
@@ -73,6 +74,7 @@ Example Response:
{
"name": "v5.0.0",
"message": null,
+ "target": "60a8ff033665e1207714d6670fcd7b65304ec02f",
"commit": {
"id": "60a8ff033665e1207714d6670fcd7b65304ec02f",
"short_id": "60a8ff03",
@@ -132,12 +134,16 @@ Parameters:
"description": "Amazing release. Wow"
},
"name": "v1.0.0",
+ "target: "2695effb5807a22ff3d138d593fd856244e155e7",
"message": null
}
```
The message will be `null` when creating a lightweight tag otherwise
it will contain the annotation.
+The target will contain the tag objects ID when creating annotated tags,
+otherwise it will contain the commit ID when creating lightweight tags.
+
In case of an error,
status code `405` with an explaining error message is returned.
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index e35b1a0ff63..8aad320e376 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -928,7 +928,7 @@ module API
end
class Tag < Grape::Entity
- expose :name, :message
+ expose :name, :message, :target
expose :commit, using: Entities::Commit do |repo_tag, options|
options[:project].repository.commit(repo_tag.dereferenced_target)
diff --git a/spec/fixtures/api/schemas/public_api/v4/tag.json b/spec/fixtures/api/schemas/public_api/v4/tag.json
index 52cfe86aeeb..10d4edb7ffb 100644
--- a/spec/fixtures/api/schemas/public_api/v4/tag.json
+++ b/spec/fixtures/api/schemas/public_api/v4/tag.json
@@ -10,6 +10,7 @@
"name": { "type": "string" },
"message": { "type": ["string", "null"] },
"commit": { "$ref": "commit/basic.json" },
+ "target": { "type": "string" },
"release": {
"oneOf": [
{ "type": "null" },