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

Gitea does not clean up old reverences on branch delete #9201

Closed
2 of 7 tasks
Tchoupinax opened this issue Nov 28, 2019 · 14 comments · Fixed by #9516 or #9614
Closed
2 of 7 tasks

Gitea does not clean up old reverences on branch delete #9201

Tchoupinax opened this issue Nov 28, 2019 · 14 comments · Fixed by #9516 or #9614
Labels
Milestone

Comments

@Tchoupinax
Copy link
Contributor

  • Gitea version (or commit ref): 1.10.0
  • Git version: Docker image
  • Operating system: Docker image
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No (On try.gitea.io, deleted branches are not kept)
    • Not relevant
  • Log gist:

Description

Hello,

Following a Discord discussion, i create this issue about deleted branches. Sometimes i meet issues when i delete my develop branch and repush an other branch also named develop.

My global issue :

I explain my situation :
I work on master and develop, and sometimes i squash develop on master, delete develop and create it again from master.
I squashed and merged with gitea, deleted branch from UI.
In local, i created develop from master. And when i pushed it on gitea, i saw in branch overview that my develop branch kept the tag "merged #4"

When i want to show branches :

template: repo/branch/list:22:106: executing "repo/branch/list" at <.Commit.ID.String>: nil pointer evaluating *git.Commit.ID

@6543 advises me to create this issue to collect data and scenario about this problem. I think there is a "global" issue when you delete and recreate same naming branch.

I can not reproduce the issue on try.gitea.io, deleted branches are not kept... It is because of the public instance or the 1.11 version ?

Update will coming :)

@6543
Copy link
Member

6543 commented Nov 28, 2019

@Tchoupinax 👍

@lunny lunny added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Dec 2, 2019
@Tchoupinax
Copy link
Contributor Author

Tchoupinax commented Dec 20, 2019

image

Example 1 : i merged develop into master, i removed develop, i created develop in local and push it to gitea... but new develop branch has a reference to the PR that concerns the old branch.

Edit: No critical error for this time.

@lunny lunny added type/bug and removed issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail labels Dec 21, 2019
@lunny lunny added this to the 1.10.2 milestone Dec 27, 2019
@Tchoupinax
Copy link
Contributor Author

Hello,

I installed the milestone 1.10.2 that should fix this problem but it appears that nothing has changed for it (or i do not understand).

image

Once again i will describe my issue :

I have two branches, master and develop. I push some code on my develop branch, create a pull request and merge it into master (with "squash and merge" option). Once it's done, i remove the develop branch with gitea (branch > trash icon). Branch is marked as deleted by me.

In local, i follow theses steps:

  • Checkout master
  • Pull
  • Delete develop branch
  • Create develop branch from master
  • Push develop

And when i have done this, Gitea keeps a reference on the pull request that have been merged (as you can see on the screenshot).

Is it the expected behaviour by the patched milestone ?
Regards,

@6543
Copy link
Member

6543 commented Jan 4, 2020

@Tchoupinax can you reopen this issue?

@Tchoupinax
Copy link
Contributor Author

I can't. :/
Let's an Gitea member reopens this please :)

@zeripath zeripath reopened this Jan 5, 2020
@zeripath
Copy link
Contributor

zeripath commented Jan 5, 2020

I've reopened but I still don't understand the problem - probably because I've not read the issue completely.

@6543

This comment has been minimized.

@6543
Copy link
Member

6543 commented Jan 5, 2020

@zeripath I can confirm the bug:

if you merge a branch into master, delete the branch and add a new branch with the same name gitea think it is the same branch and on the repo-branch-view the old PR is reverenced

This happen because gitea determine the source branch of a PR by repo and branch name

To fix this the repo-branch-view only should show merged with reference if merged_commit_id or one of the merged_commit_id.parent (should only exist two) is equal with commitID of the current branch

@6543
Copy link
Member

6543 commented Jan 5, 2020

Dont know what the correct title of THIS issue should look like ...

@Tchoupinax
Copy link
Contributor Author

@6543 Thank you for reproducing and confirming the bug ;)

zeripath added a commit to zeripath/gitea that referenced this issue Jan 5, 2020
Once a branch has been merged if the commit ID no longer equals that of
the merge commit id don't offer to delete the branch on the pull screen
and don't list it as merged on branches.

Fix go-gitea#9201
@zeripath
Copy link
Contributor

zeripath commented Jan 5, 2020

Ah I've been able to repeat this on the branches view.

I've fixed another issue - if the branch has moved on from the MergeCommitID we shouldn't offer to delete it either.


Nope I haven't fixed this... See below

@zeripath
Copy link
Contributor

zeripath commented Jan 5, 2020

The problem here is that the MergeCommitID isn't the actual head - I need to use a different ID...

@zeripath
Copy link
Contributor

zeripath commented Jan 5, 2020

OK I've come up with a solution but it's very inefficient and it needs to be improved.

The branches page likely needs some pagination too.

@6543
Copy link
Member

6543 commented Jan 6, 2020

@lafriks can you move this to 1.10.3 pleace

@lafriks lafriks modified the milestones: 1.10.2, 1.10.3 Jan 6, 2020
zeripath added a commit that referenced this issue Jan 7, 2020
Once a branch has been merged if the commit ID no longer equals that of
the pulls ref commit id don't offer to delete the branch on the pull screen
and don't list it as merged on branches.

Fix #9201

When looking at the pull page we should also get the commits from the refs/pulls/x/head

Fix #9158
zeripath added a commit to zeripath/gitea that referenced this issue Jan 7, 2020
…a#9614)

Once a branch has been merged if the commit ID no longer equals that of
the pulls ref commit id don't offer to delete the branch on the pull screen
and don't list it as merged on branches.

Fix go-gitea#9201

When looking at the pull page we should also get the commits from the refs/pulls/x/head

Fix go-gitea#9158
lafriks pushed a commit that referenced this issue Jan 8, 2020
…9639)

Once a branch has been merged if the commit ID no longer equals that of
the pulls ref commit id don't offer to delete the branch on the pull screen
and don't list it as merged on branches.

Fix #9201

When looking at the pull page we should also get the commits from the refs/pulls/x/head

Fix #9158
@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
5 participants