api/v1/repos/stephenc/repo/tags endpoint not returning lightweight tags correctly #3484

Closed
opened 2025-11-02 05:14:29 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @stephenc on GitHub (Jun 18, 2019).

Description

The api/v1/repos/stephenc/repo/tags endpoint is not returning the lightweight tags correctly. See 8de0b0a3f0 (commitcomment-33968832)

I have pushed the git repo and tags to try.gitea.io.

Here is the lightweight tag which resolves to a commit directly:

$ git show lightweight
commit 05958747e4a781e67f1ebd3248ddfba9d1846b40 (HEAD -> master, tag: lightweight, tag: annotated, origin/master, origin/HEAD)
Author: Stephen Connolly <stephenc@noreply.one-dash.com>
Date:   Thu Aug 31 19:24:47 2017 +0000

    Add 'Jenkinsfile'

diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..5495493
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1 @@
+// something
\ No newline at end of file

Here is the annotated tag which resolves to a tag object

$ git show annotated
tag annotated
Tagger: Stephen Connolly <stephen.alan.connolly@gmail.com>
Date:   Mon Jun 17 19:49:42 2019 +0100

annotated
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQEzBAABCgAdFiEEGap4SSwuDnWSnyiCgms2VIViMTgFAl0H4MYACgkQgms2VIVi
MTjYcAf/QdZ4QChhRjcnT5V5PgXD6gWBwvCnqgPcJm7QxK+IYRoBMili1oMUWGiL
J1Y5hvRopQLvScyyU544paYtM12/UYe5ovm9jUZlih+ijujmZ844xhC9WqCR6sDn
WcMm7EiRxEzyaUWwGC0zMoewW5yOk3dPBSKGXjWr3aZAkkyYW07ucItufR1Ufz3p
KYgmqaE9PqW1kn+FDb2o1/s1ZWOUqAP2t2oa76OYeTNm5fFHaRo3dcTXmgyzMIl1
DRpIxERB5QjKbvWoqj1lqEeawpv9gMfhxeKVTQYZqjM/08riKLiBLQuI37qvEWG/
r+H/0uWTdUUO0R3oL/hnpkRx++VY7g==
=ZZ+8
-----END PGP SIGNATURE-----

commit 05958747e4a781e67f1ebd3248ddfba9d1846b40 (HEAD -> master, tag: lightweight, tag: annotated, origin/master, origin/HEAD)
Author: Stephen Connolly <stephenc@noreply.one-dash.com>
Date:   Thu Aug 31 19:24:47 2017 +0000

    Add 'Jenkinsfile'

diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..5495493
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1 @@
+// something
\ No newline at end of file

Here is the current result at https://try.gitea.io/api/v1/repos/stephenc/repo/tags:

[{
    "name": "annotated",
    "id": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d",
    "commit": {
        "url": "https://try.gitea.io/api/v1/repos/stephenc/repo/git/commits/9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d",
        "sha": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d"
    },
    "zipball_url": "https://try.gitea.io/stephenc/repo/archive/annotated.zip",
    "tarball_url": "https://try.gitea.io/stephenc/repo/archive/annotated.tar.gz"
}, {
    "name": "lightweight",
    "id": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d",
    "commit": {
        "url": "https://try.gitea.io/api/v1/repos/stephenc/repo/git/commits/9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d",
        "sha": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d"
    },
    "zipball_url": "https://try.gitea.io/stephenc/repo/archive/lightweight.zip",
    "tarball_url": "https://try.gitea.io/stephenc/repo/archive/lightweight.tar.gz"
}]

Expected result:

[{
    "name": "annotated",
    "id": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d",
    "commit": {
        "url": "https://try.gitea.io/api/v1/repos/stephenc/repo/git/commits/9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d",
        "sha": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d"
    },
    "zipball_url": "https://try.gitea.io/stephenc/repo/archive/annotated.zip",
    "tarball_url": "https://try.gitea.io/stephenc/repo/archive/annotated.tar.gz"
}, {
    "name": "lightweight",
    "id": "05958747e4a781e67f1ebd3248ddfba9d1846b40",
    "commit": {
        "url": "https://try.gitea.io/api/v1/repos/stephenc/repo/git/commits/05958747e4a781e67f1ebd3248ddfba9d1846b40",
        "sha": "05958747e4a781e67f1ebd3248ddfba9d1846b40"
    },
    "zipball_url": "https://try.gitea.io/stephenc/repo/archive/lightweight.zip",
    "tarball_url": "https://try.gitea.io/stephenc/repo/archive/lightweight.tar.gz"
}]

Screenshots

Originally created by @stephenc on GitHub (Jun 18, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.9.0+dev-358-ga200ca155 - Git version: N/A - Operating system: Docker - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) https://try.gitea.io/api/v1/repos/stephenc/repo/tags - [ ] No - [ ] Not relevant - Log gist: ## Description The api/v1/repos/stephenc/repo/tags endpoint is not returning the lightweight tags correctly. See https://github.com/go-gitea/gitea/commit/8de0b0a3f06fe7879fb014d2624209e0e48455a0#commitcomment-33968832 I have pushed the git repo and tags to try.gitea.io. Here is the lightweight tag which resolves to a commit directly: ``` $ git show lightweight commit 05958747e4a781e67f1ebd3248ddfba9d1846b40 (HEAD -> master, tag: lightweight, tag: annotated, origin/master, origin/HEAD) Author: Stephen Connolly <stephenc@noreply.one-dash.com> Date: Thu Aug 31 19:24:47 2017 +0000 Add 'Jenkinsfile' diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..5495493 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1 @@ +// something \ No newline at end of file ``` Here is the annotated tag which resolves to a tag object ``` $ git show annotated tag annotated Tagger: Stephen Connolly <stephen.alan.connolly@gmail.com> Date: Mon Jun 17 19:49:42 2019 +0100 annotated -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEzBAABCgAdFiEEGap4SSwuDnWSnyiCgms2VIViMTgFAl0H4MYACgkQgms2VIVi MTjYcAf/QdZ4QChhRjcnT5V5PgXD6gWBwvCnqgPcJm7QxK+IYRoBMili1oMUWGiL J1Y5hvRopQLvScyyU544paYtM12/UYe5ovm9jUZlih+ijujmZ844xhC9WqCR6sDn WcMm7EiRxEzyaUWwGC0zMoewW5yOk3dPBSKGXjWr3aZAkkyYW07ucItufR1Ufz3p KYgmqaE9PqW1kn+FDb2o1/s1ZWOUqAP2t2oa76OYeTNm5fFHaRo3dcTXmgyzMIl1 DRpIxERB5QjKbvWoqj1lqEeawpv9gMfhxeKVTQYZqjM/08riKLiBLQuI37qvEWG/ r+H/0uWTdUUO0R3oL/hnpkRx++VY7g== =ZZ+8 -----END PGP SIGNATURE----- commit 05958747e4a781e67f1ebd3248ddfba9d1846b40 (HEAD -> master, tag: lightweight, tag: annotated, origin/master, origin/HEAD) Author: Stephen Connolly <stephenc@noreply.one-dash.com> Date: Thu Aug 31 19:24:47 2017 +0000 Add 'Jenkinsfile' diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..5495493 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1 @@ +// something \ No newline at end of file ``` Here is the current result at https://try.gitea.io/api/v1/repos/stephenc/repo/tags: ``` [{ "name": "annotated", "id": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d", "commit": { "url": "https://try.gitea.io/api/v1/repos/stephenc/repo/git/commits/9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d", "sha": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d" }, "zipball_url": "https://try.gitea.io/stephenc/repo/archive/annotated.zip", "tarball_url": "https://try.gitea.io/stephenc/repo/archive/annotated.tar.gz" }, { "name": "lightweight", "id": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d", "commit": { "url": "https://try.gitea.io/api/v1/repos/stephenc/repo/git/commits/9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d", "sha": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d" }, "zipball_url": "https://try.gitea.io/stephenc/repo/archive/lightweight.zip", "tarball_url": "https://try.gitea.io/stephenc/repo/archive/lightweight.tar.gz" }] ``` Expected result: ``` [{ "name": "annotated", "id": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d", "commit": { "url": "https://try.gitea.io/api/v1/repos/stephenc/repo/git/commits/9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d", "sha": "9a4ac36d615d3e4a56635e31bb60b75bdebd5d6d" }, "zipball_url": "https://try.gitea.io/stephenc/repo/archive/annotated.zip", "tarball_url": "https://try.gitea.io/stephenc/repo/archive/annotated.tar.gz" }, { "name": "lightweight", "id": "05958747e4a781e67f1ebd3248ddfba9d1846b40", "commit": { "url": "https://try.gitea.io/api/v1/repos/stephenc/repo/git/commits/05958747e4a781e67f1ebd3248ddfba9d1846b40", "sha": "05958747e4a781e67f1ebd3248ddfba9d1846b40" }, "zipball_url": "https://try.gitea.io/stephenc/repo/archive/lightweight.zip", "tarball_url": "https://try.gitea.io/stephenc/repo/archive/lightweight.tar.gz" }] ``` ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/bug label 2025-11-02 05:14:29 -06:00
Author
Owner

@lunny commented on GitHub (Jun 18, 2019):

@richmahn could you have time to take a look at this issue?

@lunny commented on GitHub (Jun 18, 2019): @richmahn could you have time to take a look at this issue?
Author
Owner

@richmahn commented on GitHub (Jun 24, 2019):

@lunny Just saw the notification for it. Yes, will look.

@richmahn commented on GitHub (Jun 24, 2019): @lunny Just saw the notification for it. Yes, will look.
Author
Owner

@richmahn commented on GitHub (Jun 24, 2019):

@stephenc Looking into this. Shouldn't the SHA of the commit of the annotated tag be "05958747e4a781e67f1ebd3248ddfba9d1846b40" like both SHAs of the lightweight? That is, the commit SHA should be different than the tag SHA. I thought I had that working, but appears not. Thanks for finding that.

@richmahn commented on GitHub (Jun 24, 2019): @stephenc Looking into this. Shouldn't the SHA of the commit of the annotated tag be "05958747e4a781e67f1ebd3248ddfba9d1846b40" like both SHAs of the lightweight? That is, the commit SHA should be different than the tag SHA. I thought I had that working, but appears not. Thanks for finding that.
Author
Owner

@stephenc commented on GitHub (Jun 24, 2019):

Yes the sha should be the same, The id perhaps not

@stephenc commented on GitHub (Jun 24, 2019): Yes the sha should be the same, The id perhaps not
Author
Owner

@richmahn commented on GitHub (Jun 28, 2019):

@stephenc Ok, made a PR. You can see my JSON output in the PR description: https://github.com/go-gitea/gitea/pull/7321

@richmahn commented on GitHub (Jun 28, 2019): @stephenc Ok, made a PR. You can see my JSON output in the PR description: https://github.com/go-gitea/gitea/pull/7321
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3484