Skip to content

Empty repository show error 500 #18722

Closed
@TOMeeeek

Description

@TOMeeeek

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

Activity

added
issue/regressionIndicates a previously functioning feature or behavior that has broken or regressed after a change
on Feb 11, 2022
wxiaoguang

wxiaoguang commented on Feb 11, 2022

@wxiaoguang
Contributor

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

wxiaoguang commented on Feb 11, 2022

@wxiaoguang
Contributor

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.

added
issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implemented
on Feb 11, 2022
added this to the 1.16.2 milestone on Feb 11, 2022
lunny

lunny commented on Feb 11, 2022

@lunny
Member

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

zeripath commented on Feb 12, 2022

@zeripath
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

wxiaoguang commented on Feb 13, 2022

@wxiaoguang
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

lunny commented on Feb 13, 2022

@lunny
Member

git show-ref HEAD

git show-ref HEAD is not work from me.

locked and limited conversation to collaborators on Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedissue/regressionIndicates a previously functioning feature or behavior that has broken or regressed after a changetype/bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @lunny@TOMeeeek@zeripath@wxiaoguang

      Issue actions

        Empty repository show error 500 · Issue #18722 · go-gitea/gitea