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

Empty repository show error 500 #18722

Closed
TOMeeeek opened this issue Feb 11, 2022 · 6 comments · Fixed by #18746
Closed

Empty repository show error 500 #18722

TOMeeeek opened this issue Feb 11, 2022 · 6 comments · Fixed by #18746
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/regression Indicates a previously functioning feature or behavior that has broken or regressed after a change type/bug
Milestone

Comments

@TOMeeeek
Copy link

TOMeeeek commented Feb 11, 2022

Gitea Version

1.16.1

Git Version

2.13.6

Operating System

Ubuntu server 20.04

How are you running Gitea?

Installed from binary

Database

MySQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/TOMeeeek/554a4d6ed4a6336683904887c086f0e4

2022/02/11 12:53:54 ...ers/web/repo/view.go:860:renderCode() [E] GitRepo.IsEmpty: check empty: exit status 129 - usage: git rev-list [OPTION] <commit-id>... [ -->
          limiting output:
            --max-count=<n>
            --max-age=<epoch>
            --min-age=<epoch>
            --sparse
            --no-merges
            --min-parents=<n>
            --no-min-parents
            --max-parents=<n>
            --no-max-parents
            --remove-empty
            --all
            --branches
            --tags
            --remotes
            --stdin
            --quiet
          ordering output:
            --topo-order
            --date-order
            --reverse
          formatting output:
            --parents
            --children
            --objects | --objects-edge
            --unpacked
            --header | --pretty
            --abbrev=<n> | --no-abbrev
            --abbrev-commit
            --left-right
            --count
          special purpose:
            --bisect
            --bisect-vars
            --bisect-all

Description

After upgrading from Gitea 1.15.9 to 1.16.1, a 500 error is reported when entering an empty repository. When downgrading to 1.15.9 again everything is without problems.

Screenshots

No response

@wxiaoguang wxiaoguang added type/bug issue/regression Indicates a previously functioning feature or behavior that has broken or regressed after a change labels Feb 11, 2022
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Feb 11, 2022

Possible related to:

I guess that old git need at lease one <commit> in the arguments. New git can omit the <commit>
(update: actually, it's a git bug, old version only, rev-list --all doesn't work on an empty repo)

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Feb 11, 2022

Confirmed, it is the case. But git document never mentioned that.

If we run git rev-list --all on an empty git, old git would report errors.

@wxiaoguang wxiaoguang added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Feb 11, 2022
@wxiaoguang wxiaoguang added this to the 1.16.2 milestone Feb 11, 2022
@lunny
Copy link
Member

lunny commented Feb 11, 2022

Confirmed, it is the case. But git document never mentioned that.

If we run git rev-list --all on an empty git, old git would report errors.

What's the old git version?

@zeripath
Copy link
Contributor

Can we use:

git show-ref HEAD

Instead.

Btw @lunny I missed your reply on my comment:

git rev-list --all 

Still just uses the HEAD branch. If we wanted to check if a repo had any branches or tags we'd need to use for-each-ref or the like.

@wxiaoguang
Copy link
Contributor

What's the old git version?

Author reported 2.13.6, I tried 2.11.x, they all have this bug. It seems that 2.3x doesn't have the bug, but I do not know which version fixed it.

@lunny
Copy link
Member

lunny commented Feb 13, 2022

git show-ref HEAD

git show-ref HEAD is not work from me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/regression Indicates a previously functioning feature or behavior that has broken or regressed after a change type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants