diff --git a/src/main/scala/gitbucket/core/api/ApiRef.scala b/src/main/scala/gitbucket/core/api/ApiRef.scala index 8f4f92f..e765127 100644 --- a/src/main/scala/gitbucket/core/api/ApiRef.scala +++ b/src/main/scala/gitbucket/core/api/ApiRef.scala @@ -28,7 +28,7 @@ url = ApiPath(s"/api/v3/repos/${repositoryName.fullName}/git/${ref.getName}"), `object` = ApiRefCommit( sha = ref.getObjectId.getName, - url = ApiPath(s"/api/v3/repos/${repositoryName.fullName}/git/commits/${ref.getObjectId.getName}"), + url = ApiPath(s"/api/v3/repos/${repositoryName.fullName}/commits/${ref.getObjectId.getName}"), `type` = "commit" ) ) @@ -40,10 +40,16 @@ ApiRef( ref = s"refs/tags/${tagInfo.name}", url = ApiPath(s"/api/v3/repos/${repositoryName.fullName}/git/refs/tags/${tagInfo.name}"), + //the GH api distinguishes between "releases" and plain git tags + //for "releases", the api returns a reference to the release object (with type `tag`) + //this would be something like s"/api/v3/repos/${repositoryName.fullName}/git/tags/" + //with a hash for the tag, which I do not fully understand + //since this is not yet implemented in GB, we always return a link to the plain `commit` object, + //which GH does for tags that are not annotated `object` = ApiRefCommit( sha = tagInfo.objectId, - url = ApiPath(s"/api/v3/repos/${repositoryName.fullName}/git/tags/${tagInfo.objectId}"), // TODO This URL is not yet available? - `type` = "tag" + url = ApiPath(s"/api/v3/repos/${repositoryName.fullName}/commits/${tagInfo.objectId}"), + `type` = "commit" ) ) } diff --git a/src/test/scala/gitbucket/core/api/ApiIntegrationTest.scala b/src/test/scala/gitbucket/core/api/ApiIntegrationTest.scala index d424d89..2b34dbf 100644 --- a/src/test/scala/gitbucket/core/api/ApiIntegrationTest.scala +++ b/src/test/scala/gitbucket/core/api/ApiIntegrationTest.scala @@ -156,7 +156,6 @@ val ref = repo.getRef("tags/v1.0") assert(ref.getRef == "refs/tags/v1.0") assert(ref.getUrl.toString == "http://localhost:19999/api/v3/repos/root/create_status_test/git/refs/tags/v1.0") - assert(ref.getObject.getType == "tag") } } }