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

500 error when reopening an Agit PR #26334

Closed
Infinoid opened this issue Aug 4, 2023 · 1 comment · Fixed by #26399
Closed

500 error when reopening an Agit PR #26334

Infinoid opened this issue Aug 4, 2023 · 1 comment · Fixed by #26399
Labels
Milestone

Comments

@Infinoid
Copy link
Contributor

Infinoid commented Aug 4, 2023

Description

Some of our users get a bit lost when we start talking about branches and forks; they use the Agit syntax to submit PRs. This mostly works.

When an Agit-submitted PR is closed, and then the "Reopen" button is pressed, the server responds with a 500 internal server error.

Ideally it would not return a 500 error; it would either reopen the PR, or (more likely) provide a clear error message about the temporary branch being deleted (or whatever).

I included a log from our production instance from when we first noticed this problem. It's quite short.

Reproducer

First, make a git repo. I called mine "test". Add a file, commit it, push it to the server.

% git init
Initialized empty Git repository in .../test/.git/
% echo test >test
% git add test
% git commit
[main (root-commit) c842de3] test
 1 file changed, 1 insertion(+)
 create mode 100644 test
% git remote add origin https://try.gitea.io/infinoid/test-agit.git
% git push -u origin main
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 207 bytes | 207.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: . Processing 1 references
remote: Processed 1 references in total
To https://try.gitea.io/infinoid/test-agit.git
 * [new branch]      main -> main
branch 'main' set up to track 'origin/main'.
% 

Next, add a second commit, and submit it using Agit syntax.

% echo test2 > test2
% git add test2
% git commit
[main f6c5761] test2
 1 file changed, 1 insertion(+)
 create mode 100644 test2
% git push origin HEAD:refs/for/main -o topic=test2 -o title=test2 -o description=test2
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 64 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 263 bytes | 263.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: 
remote: Visit the existing pull request:
remote:   https://try.gitea.io/infinoid/test-agit/pulls/1
remote: 
remote: . Processing 1 references
remote: Processed 1 references in total
To https://try.gitea.io/infinoid/test-agit.git
 * [new reference]   HEAD -> refs/pull/1/head
% 

Click on the link to the new PR (number 1 in my test repo).
Click the Close button.
Click the Reopen button.
Bam, 500 error.

Gitea Version

1.20.2, 1.21.0+dev-463-g6a7a5ea32 (the version of try.gitea.io at time of writing)

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

https://gist.github.com/Infinoid/65cf9fb54e87a8cb3acd83dccee7e7d5

Screenshots

image

Git Version

No response

Operating System

No response

How are you running Gitea?

I was able to reproduce this problem on try.gitea.io.

Database

None

@lunny
Copy link
Member

lunny commented Aug 5, 2023

@a1012112796 could you help to take a look at?

a1012112796 added a commit to a1012112796/gitea that referenced this issue Aug 8, 2023
the head branch is meaningless for a
agit flow pull request, so should not
check it when reopen it.

related: go-gitea#24231
fix go-gitea#26334

Signed-off-by: a1012112796 <1012112796@qq.com>
@lunny lunny added this to the 1.20.3 milestone Aug 14, 2023
KN4CK3R pushed a commit that referenced this issue Aug 19, 2023
the head branch is meaningless for a agit flow pull request, so should
not check it when reopen it.

related: #24231
fix #26334

Signed-off-by: a1012112796 <1012112796@qq.com>
a1012112796 added a commit to a1012112796/gitea that referenced this issue Aug 21, 2023
the head branch is meaningless for a agit flow pull request, so should
not check it when reopen it.

related: go-gitea#24231
fix go-gitea#26334

Signed-off-by: a1012112796 <1012112796@qq.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2023
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.

2 participants