Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 of 7 tasks
stephenc opened this issue Jun 18, 2019 · 5 comments · Fixed by #7321
Closed
2 of 7 tasks

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

stephenc opened this issue Jun 18, 2019 · 5 comments · Fixed by #7321
Labels
Milestone

Comments

@stephenc
Copy link

Description

The api/v1/repos/stephenc/repo/tags endpoint is not returning the lightweight tags correctly. See 8de0b0a#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

stephenc referenced this issue Jun 18, 2019
* Fixes #2738 - /git/tags API

* proper URLs

* Adds function comments

* Updates swagger

* Removes newline from tag message

* Removes trailing newline from commit message

* Adds integration test

* Removed debugging

* Adds tests

* Fixes bug where multiple tags of same commit show wrong tag name

* Fix formatting

* Removes unused varaible

* Fix to annotated tag function names and response

* Update modules/git/repo_tag.go

Co-Authored-By: Lauris BH <lauris@nix.lv>

* Uses TagPrefix

* Changes per review, better error handling for getting tag and commit IDs

* Fix to getting commit ID

* Fix to getting commit ID

* Fix to getting commit ID

* Fix to getting commit ID
@lunny lunny added the type/bug label Jun 18, 2019
@lunny
Copy link
Member

lunny commented Jun 18, 2019

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

@richmahn
Copy link
Contributor

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

@richmahn
Copy link
Contributor

@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.

@stephenc
Copy link
Author

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

@richmahn
Copy link
Contributor

@stephenc Ok, made a PR. You can see my JSON output in the PR description: #7321

richmahn added a commit to richmahn/gitea that referenced this issue Jun 28, 2019
@lunny lunny added this to the 1.9.0 milestone Jun 29, 2019
zeripath pushed a commit to lunny/gitea that referenced this issue Jun 29, 2019
* Fixes go-gitea#7238 - Annotated tag commit ID incorrect

* Fixes go-gitea#7238 - Annotated tag commit ID incorrect
jeffliu27 pushed a commit to jeffliu27/gitea that referenced this issue Jul 18, 2019
* Fixes go-gitea#7238 - Annotated tag commit ID incorrect

* Fixes go-gitea#7238 - Annotated tag commit ID incorrect
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants