Empty repository show error 500 #8548

Closed
opened 2025-11-02 08:10:28 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @TOMeeeek on GitHub (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

Originally created by @TOMeeeek on GitHub (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_
GiteaMirror added the issue/confirmedissue/regressiontype/bug labels 2025-11-02 08:10:28 -06:00
Author
Owner

@wxiaoguang commented on GitHub (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 commented on GitHub (Feb 11, 2022): Possible related to: * #18422 ~~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)
Author
Owner

@wxiaoguang commented on GitHub (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 commented on GitHub (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.
Author
Owner

@lunny commented on GitHub (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?

@lunny commented on GitHub (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?
Author
Owner

@zeripath commented on GitHub (Feb 12, 2022):

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.

@zeripath commented on GitHub (Feb 12, 2022): 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.
Author
Owner

@wxiaoguang commented on GitHub (Feb 13, 2022):

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.

@wxiaoguang commented on GitHub (Feb 13, 2022): > 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.
Author
Owner

@lunny commented on GitHub (Feb 13, 2022):

git show-ref HEAD

git show-ref HEAD is not work from me.

@lunny commented on GitHub (Feb 13, 2022): > git show-ref HEAD `git show-ref HEAD` is not work from me.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8548