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

The derived warehouse is converted to an ordinary warehouse, and the derived quantity has not changed #17026

Closed
yixiaco opened this issue Sep 12, 2021 · 3 comments · Fixed by #17035
Labels
Milestone

Comments

@yixiaco
Copy link

yixiaco commented Sep 12, 2021

  • Gitea version 1.15.2:
  • Database : MySQL

Screenshots

image
The derived warehouse was modified by me to a normal warehouse

@noerw
Copy link
Member

noerw commented Sep 12, 2021

translation: converting a fork to a standalone repo does not affect the fork counter of the original repo 🙃

@zeripath
Copy link
Contributor

The issue is that:

repo.IsFork = false
repo.ForkID = 0
if err := models.UpdateRepository(repo, false); err != nil {
log.Error("Unable to update repository %-v whilst converting from fork", repo)
ctx.ServerError("Convert Fork", err)
return
}

Does not also call:

		if _, err := sess.Exec("UPDATE `repository` SET num_forks=num_forks-1 WHERE id=?", repo.ForkID); err != nil {
			return fmt.Errorf("decrease fork count: %v", err)
		}

within the transaction that UpdateRepository happens in.

There should be a new function ConvertFromFork within models/repo_*.go that will do the necessary updating of the root repo.

@zeripath
Copy link
Contributor

Or probably better UpdateRepository needs to load and check if the repo has changed and handle the necessary changes itself

@axifive axifive added this to the 1.16.0 milestone Sep 13, 2021
@zeripath zeripath modified the milestones: 1.16.0, 1.15.3 Sep 13, 2021
zeripath added a commit to zeripath/gitea that referenced this issue Sep 13, 2021
When converting repositories from forks to normal the root NumFork needs to be
decremented too.

Fix go-gitea#17026

Signed-off-by: Andrew Thornton <[email protected]>
zeripath added a commit that referenced this issue Sep 14, 2021
When converting repositories from forks to normal the root NumFork needs to be
decremented too.

Fix #17026

Signed-off-by: Andrew Thornton <[email protected]>
zeripath added a commit to zeripath/gitea that referenced this issue Sep 14, 2021
Backport go-gitea#17035

When converting repositories from forks to normal the root NumFork needs to be
decremented too.

Fix go-gitea#17026

Signed-off-by: Andrew Thornton <[email protected]>
lunny pushed a commit that referenced this issue Sep 15, 2021
Backport #17035

When converting repositories from forks to normal the root NumFork needs to be
decremented too.

Fix #17026

Signed-off-by: Andrew Thornton <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
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.

4 participants