Skip to content

500 error when reopening an Agit PR #26334

Closed
@Infinoid

Description

@Infinoid

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions