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

Release is not Updated when recreating Tag #26090

Closed
JakobDev opened this issue Jul 24, 2023 · 9 comments · Fixed by #29261
Closed

Release is not Updated when recreating Tag #26090

JakobDev opened this issue Jul 24, 2023 · 9 comments · Fixed by #29261
Labels
issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP type/bug
Milestone

Comments

@JakobDev
Copy link
Contributor

Description

If you recreate a Tag on a new Commit, the Release will not be updated.

Steps to reproduce:

  1. Create a new Repo
  2. Create a new Release with a Tag called "Test"
  3. Clone the Repo
  4. Run these commands:
git tag -d Test
git commit --allow-empty -m "New Commit"
git tag Test
git push
git push -f --tags

If you visit the Release Page, it shows

1 commits to main since this release

But this is not true. The Tag has now changed to the latest Commit.

I expect Gitea to do one of these 2 Options:

  1. Just Update the Release
  2. Do the same as if the Tag was deleted

Gitea Version

1.20.1

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

Not relevant to reproduce

Screenshots

No response

Git Version

2.41.0

Operating System

Manjaro

How are you running Gitea?

Binary downloaded from GitHub

Database

SQLite

@lunny lunny added the issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP label Jul 27, 2023
@CaiCandong
Copy link
Member

I can't reproduce your problem on gitea, I'm getting everything fine, Release is being updated automatically.
https://gitea.com/caicandong/gitea-debug
image
image

@JakobDev
Copy link
Contributor Author

JakobDev commented Aug 1, 2023

What have you done? Delete Tag > Push > Recreate Tag > Push or Delete Tag > Recreate Tag > Push?

@CaiCandong
Copy link
Member

CaiCandong commented Aug 1, 2023

What have you done? Delete Tag > Push > Recreate Tag > Push or Delete Tag > Recreate Tag > Push?

Follow your reproduction steps

@CaiCandong
Copy link
Member

@JakobDev I recorded a video that you can watch.

default.mp4

@JakobDev
Copy link
Contributor Author

JakobDev commented Aug 1, 2023

Interesting. Did you try this on 1.20.1 or the latest commit?

@CaiCandong
Copy link
Member

Interesting. Did you try this on 1.20.1 or the latest commit?

My code is based on the latest commit

@Zettat123
Copy link
Contributor

@JakobDev I recorded a video that you can watch.

default.mp4

That's weird. I followed the steps in this video and finally reproduced the bug

@wolfogre
Copy link
Member

The point is that the tag Test has an uppercase letter, and the incorrect code attempted to find existing releases with a lower name but couldn't find it. Then, when it tried to create a new one, it failed due to a unique index constraint. Therefore, you should see this error log:

2024/02/19 16:15:45 ...s/repository/push.go:41:handler() [E] pushUpdate[root/update_tag_release] failed: PushUpdateAddDeleteTags: Insert: pq: duplicate key value violates unique constraint "UQE_release_n"

And why can't CaiCandong reproduce, while Zettat123 can? I think CaiCandong is using a database that is case-insensitive, maybe MySQL with a case-insensitive collation.

lunny pushed a commit that referenced this issue Feb 19, 2024
Fix #26090, see
#26090 (comment)

Since `TagName` stores the original tag name and `LowerTagName` stores
the lower tag name, it doesn't make sense to use lowercase tags as
`TagNames` in `FindReleasesOptions`.


https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/services/repository/push.go#L396-L397

While the only other usage looks correct:


https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/routers/web/repo/repo.go#L416
lunny pushed a commit that referenced this issue Feb 19, 2024
Backport #29261.

Fix #26090, see
#26090 (comment)

Since `TagName` stores the original tag name and `LowerTagName` stores
the lower tag name, it doesn't make sense to use lowercase tags as
`TagNames` in `FindReleasesOptions`.

https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/services/repository/push.go#L396-L397

While the only other usage looks correct:

https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/routers/web/repo/repo.go#L416
DennisRasey pushed a commit to DennisRasey/forgejo that referenced this issue Feb 20, 2024
Fix #26090, see
go-gitea/gitea#26090 (comment)

Since `TagName` stores the original tag name and `LowerTagName` stores
the lower tag name, it doesn't make sense to use lowercase tags as
`TagNames` in `FindReleasesOptions`.

https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/services/repository/push.go#L396-L397

While the only other usage looks correct:

https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/routers/web/repo/repo.go#L416
(cherry picked from commit 0ea8de2d0729e1e1d0ea9de1e59fbcb673e87fd2)
DennisRasey pushed a commit to DennisRasey/forgejo that referenced this issue Feb 20, 2024
Backport #29261.

Fix #26090, see
go-gitea/gitea#26090 (comment)

Since `TagName` stores the original tag name and `LowerTagName` stores
the lower tag name, it doesn't make sense to use lowercase tags as
`TagNames` in `FindReleasesOptions`.

https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/services/repository/push.go#L396-L397

While the only other usage looks correct:

https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/routers/web/repo/repo.go#L416
(cherry picked from commit f79530c50ee1c7833cae13e56531e5d1fd66f5ba)
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
Fix go-gitea#26090, see
go-gitea#26090 (comment)

Since `TagName` stores the original tag name and `LowerTagName` stores
the lower tag name, it doesn't make sense to use lowercase tags as
`TagNames` in `FindReleasesOptions`.


https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/services/repository/push.go#L396-L397

While the only other usage looks correct:


https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/routers/web/repo/repo.go#L416
Copy link

github-actions bot commented Mar 1, 2024

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants